Commit 5c1c9b8f authored by Mccaskey, Alex's avatar Mccaskey, Alex

setting up gtest to always build/install

Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 201650e0
......@@ -75,39 +75,6 @@ if (XACC_BUILD_TESTS)
message(STATUS "Set ${VAR_NAME} to ${${VAR_NAME}}.")
endmacro()
add_subdirectory(tpls/cpr/opt/googletest)
if(APPLE)
set_target_properties(gtest PROPERTIES INSTALL_RPATH "@loader_path")
set_target_properties(gtest_main PROPERTIES INSTALL_RPATH "@loader_path")
else()
set_target_properties(gtest PROPERTIES INSTALL_RPATH "$ORIGIN")
set_target_properties(gtest_main PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
set(GTEST_FOUND TRUE)
set(GTEST_LIBRARIES gtest)
set(GTEST_MAIN_LIBRARIES gtest_main)
set(GTEST_BOTH_LIBRARIES gtest gtest_main)
set(GTEST_INCLUDE_DIRS ${gtest_SOURCE_DIR}/include)
set_property(TARGET gtest PROPERTY FOLDER "tests/gtest")
set_property(TARGET gtest_main PROPERTY FOLDER "tests/gtest")
set_cache_variable(GTEST_FOUND "Set if libgtest was found or built")
set_cache_variable(GTEST_LIBRARIES "Location of libgtest")
set_cache_variable(GTEST_MAIN_LIBRARIES "Location of libgtest-main")
set_cache_variable(GTEST_BOTH_LIBRARIES "Location of both gtest libraries")
set_cache_variable(GTEST_INCLUDE_DIRS "Location of gtest include files")
include_directories(${GTEST_INCLUDE_DIRS})
install( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/cpr/opt/googletest/include/gtest" DESTINATION include/gtest )
if (APPLE)
install(FILES ${CMAKE_BINARY_DIR}/tpls/cpr/opt/googletest/libgtest.dylib DESTINATION lib)
install(FILES ${CMAKE_BINARY_DIR}/tpls/cpr/opt/googletest/libgtest_main.dylib DESTINATION lib)
else()
install(FILES ${CMAKE_BINARY_DIR}/tpls/cpr/opt/googletest/libgtest.so DESTINATION lib)
install(FILES ${CMAKE_BINARY_DIR}/tpls/cpr/opt/googletest/libgtest_main.so DESTINATION lib)
endif()
endif()
# Setup Doxygen
......
......@@ -12,11 +12,10 @@ endif()
set (XACC_INCLUDE_DIRS "${XACC_ROOT}/include/cppmicroservices4;${XACC_ROOT}/include/xacc;${XACC_ROOT}/include/quantum/gate;${XACC_ROOT}/include/quantum/aqc;${XACC_ROOT}/include/spdlog;${XACC_ROOT}/include/exprtk;${XACC_ROOT}/include/eigen;${XACC_ROOT}/include/rapidjson/include;${XACC_ROOT}/include;${XACC_ROOT}/include/gtest")
set (XACC_LIBRARY_DIR "${XACC_ROOT}/lib")
link_directories("${XACC_ROOT}/lib")
set (XACC_LIBRARIES "xacc;CppMicroServices;boost_system;boost_filesystem;boost_regex;boost_graph;boost_program_options")
set (XACC_TEST_LIBRARIES "xacc;CppMicroServices;boost_system;boost_filesystem;boost_regex;boost_graph;boost_program_options;gtest;gtest_main")
set (XACC_LIBRARIES "xacc;xacc-quantum-gate;xacc-quantum-aqc;CppMicroServices;boost_system;boost_filesystem;boost_regex;boost_graph;boost_program_options")
set (XACC_TEST_LIBRARIES "${XACC_LIBRARIES};gtest;gtest_main")
set(BOOST_ROOT ${XACC_ROOT})
macro(add_xacc_test _TEST_NAME)
# include_directories(${XACC_INCLUDE_DIRS})
add_executable(${_TEST_NAME}Tester ${_TEST_NAME}Tester.cpp)
add_test(NAME xacc_${_TEST_NAME}Tester COMMAND ${_TEST_NAME}Tester)
target_link_libraries(${_TEST_NAME}Tester ${XACC_TEST_LIBRARIES})
......
......@@ -19,6 +19,40 @@ set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(BUILD_SHARED_LIBS FALSE)
add_subdirectory(cpr)
add_subdirectory(cpr/opt/googletest)
if(APPLE)
set_target_properties(gtest PROPERTIES INSTALL_RPATH "@loader_path")
set_target_properties(gtest_main PROPERTIES INSTALL_RPATH "@loader_path")
else()
set_target_properties(gtest PROPERTIES INSTALL_RPATH "$ORIGIN")
set_target_properties(gtest_main PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
set(GTEST_FOUND TRUE)
set(GTEST_LIBRARIES gtest)
set(GTEST_MAIN_LIBRARIES gtest_main)
set(GTEST_BOTH_LIBRARIES gtest gtest_main)
set(GTEST_INCLUDE_DIRS ${gtest_SOURCE_DIR}/include)
set_property(TARGET gtest PROPERTY FOLDER "tests/gtest")
set_property(TARGET gtest_main PROPERTY FOLDER "tests/gtest")
set_cache_variable(GTEST_FOUND "Set if libgtest was found or built")
set_cache_variable(GTEST_LIBRARIES "Location of libgtest")
set_cache_variable(GTEST_MAIN_LIBRARIES "Location of libgtest-main")
set_cache_variable(GTEST_BOTH_LIBRARIES "Location of both gtest libraries")
set_cache_variable(GTEST_INCLUDE_DIRS "Location of gtest include files")
include_directories(${GTEST_INCLUDE_DIRS})
install( DIRECTORY "${CMAKE_SOURCE_DIR}/tpls/cpr/opt/googletest/include/gtest" DESTINATION include/gtest )
if (APPLE)
install(FILES ${CMAKE_BINARY_DIR}/tpls/cpr/opt/googletest/libgtest.dylib DESTINATION lib)
install(FILES ${CMAKE_BINARY_DIR}/tpls/cpr/opt/googletest/libgtest_main.dylib DESTINATION lib)
else()
install(FILES ${CMAKE_BINARY_DIR}/tpls/cpr/opt/googletest/libgtest.so DESTINATION lib)
install(FILES ${CMAKE_BINARY_DIR}/tpls/cpr/opt/googletest/libgtest_main.so DESTINATION lib)
endif()
set(BOOST_LIBS_OPTIONAL program_options system filesystem regex graph CACHE STRING "" FORCE)
add_subdirectory(boost-cmake)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment