2016-08-26 01:22:04 +03:00
|
|
|
if (CXXOPTS_BUILD_TESTS)
|
2017-05-31 10:40:14 +03:00
|
|
|
add_executable(options_test main.cpp options.cpp)
|
2016-12-02 23:44:46 +03:00
|
|
|
target_link_libraries(options_test cxxopts)
|
2017-06-23 11:38:42 +03:00
|
|
|
add_test(options options_test)
|
2016-11-30 10:03:28 +03:00
|
|
|
|
2017-06-23 11:38:42 +03:00
|
|
|
# test if the targets are findable from the build directory
|
|
|
|
|
add_test(find-package-test ${CMAKE_CTEST_COMMAND}
|
|
|
|
|
-C ${CMAKE_BUILD_TYPE}
|
|
|
|
|
--build-and-test
|
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/find-package-test"
|
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/find-package-test"
|
|
|
|
|
--build-generator ${CMAKE_GENERATOR}
|
|
|
|
|
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
|
|
|
|
|
--build-options
|
|
|
|
|
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
|
|
|
|
|
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
|
|
|
|
|
"-Dcxxopts_DIR=${PROJECT_BINARY_DIR}"
|
|
|
|
|
)
|
2016-08-26 01:22:04 +03:00
|
|
|
|
2017-06-23 11:38:42 +03:00
|
|
|
# test if the targets are findable when add_subdirectory is used
|
|
|
|
|
add_test(add-subdirectory-test ${CMAKE_CTEST_COMMAND}
|
|
|
|
|
-C ${CMAKE_BUILD_TYPE}
|
|
|
|
|
--build-and-test
|
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/add-subdirectory-test"
|
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/add-subdirectory-test"
|
|
|
|
|
--build-generator ${CMAKE_GENERATOR}
|
|
|
|
|
--build-makeprogram ${CMAKE_MAKE_PROGRAM}
|
|
|
|
|
--build-options
|
|
|
|
|
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
|
|
|
|
|
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
|
|
|
|
|
)
|
2016-08-26 01:22:04 +03:00
|
|
|
endif()
|