Commit 7b458fa3 authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

[CMake] Fix usage of BUILD_TESTING + target_link_libraries

parent 55c97280
...@@ -59,6 +59,7 @@ include(cmake/python.cmake) ...@@ -59,6 +59,7 @@ include(cmake/python.cmake)
include(cmake/hpp.cmake) include(cmake/hpp.cmake)
include(cmake/apple.cmake) include(cmake/apple.cmake)
include(cmake/ide.cmake) include(cmake/ide.cmake)
include(cmake/test.cmake)
# If needed, fix CMake policy for APPLE systems # If needed, fix CMake policy for APPLE systems
APPLY_DEFAULT_APPLE_CONFIGURATION() APPLY_DEFAULT_APPLE_CONFIGURATION()
...@@ -156,9 +157,7 @@ add_subdirectory(src) ...@@ -156,9 +157,7 @@ add_subdirectory(src)
if (BUILD_PYTHON_INTERFACE) if (BUILD_PYTHON_INTERFACE)
add_subdirectory(python) add_subdirectory(python)
endif () endif ()
if (BUILD_TESTING) add_subdirectory(test)
add_subdirectory(test)
endif ()
pkg_config_append_libs("hpp-fcl") pkg_config_append_libs("hpp-fcl")
PKG_CONFIG_APPEND_BOOST_LIBS(thread date_time filesystem system) PKG_CONFIG_APPEND_BOOST_LIBS(thread date_time filesystem system)
......
config_files(fcl_resources/config.h) config_files(fcl_resources/config.h)
macro(add_fcl_test test_name) macro(add_fcl_test test_name source)
add_executable(${ARGV}) ADD_UNIT_TEST(${test_name} ${source})
target_link_libraries(${test_name} target_link_libraries(${test_name}
PUBLIC PUBLIC
${PROJECT_NAME} hpp-fcl
${Boost_LIBRARIES} ${Boost_LIBRARIES}
Boost::unit_test_framework Boost::unit_test_framework
utility utility
) )
PKG_CONFIG_USE_DEPENDENCY(${test_name} assimp) PKG_CONFIG_USE_DEPENDENCY(${test_name} assimp)
add_test(${test_name} ${EXECUTABLE_OUTPUT_PATH}/${test_name})
target_compile_options(${test_name} PRIVATE "-Wno-c99-extensions") target_compile_options(${test_name} PRIVATE "-Wno-c99-extensions")
endmacro(add_fcl_test) endmacro(add_fcl_test)
...@@ -54,7 +53,11 @@ if(HPP_FCL_HAVE_OCTOMAP) ...@@ -54,7 +53,11 @@ if(HPP_FCL_HAVE_OCTOMAP)
endif(HPP_FCL_HAVE_OCTOMAP) endif(HPP_FCL_HAVE_OCTOMAP)
## Benchmark ## Benchmark
add_executable(test-benchmark benchmark.cpp) IF(BUILD_TESTING)
add_executable(test-benchmark benchmark.cpp)
ELSE()
add_executable(test-benchmark EXCLUDE_FROM_ALL benchmark.cpp)
ENDIF()
target_link_libraries(test-benchmark target_link_libraries(test-benchmark
PUBLIC PUBLIC
utility utility
......
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