Verified Commit 13b5268f authored by Justin Carpentier's avatar Justin Carpentier
Browse files

cmake/test: change policy - do build TESTs by default

parent ea1969ae
...@@ -19,7 +19,6 @@ INCLUDE(cmake/test.cmake) ...@@ -19,7 +19,6 @@ INCLUDE(cmake/test.cmake)
SET(PROJECT_NAME eigenpy) SET(PROJECT_NAME eigenpy)
SET(PROJECT_DESCRIPTION "Wrapping Eigen3 -- numpy") SET(PROJECT_DESCRIPTION "Wrapping Eigen3 -- numpy")
SET(PROJECT_URL "http://github.com/stack-of-tasks/eigenpy") SET(PROJECT_URL "http://github.com/stack-of-tasks/eigenpy")
OPTION(INSTALL_DOCUMENTATION "Generate and install the documentation" FALSE)
# Disable -Werror on Unix for now. # Disable -Werror on Unix for now.
SET(CXX_DISABLE_WERROR True) SET(CXX_DISABLE_WERROR True)
...@@ -47,11 +46,17 @@ ELSE(WIN32) ...@@ -47,11 +46,17 @@ ELSE(WIN32)
SET(LINK create_symlink) SET(LINK create_symlink)
ENDIF(WIN32) ENDIF(WIN32)
# ---------------------------------------------------- # ----------------------------------------------------
# --- OPTIONS --------------------------------------- # --- OPTIONS ---------------------------------------
# ---------------------------------------------------- # ----------------------------------------------------
OPTION (BUILD_UNIT_TESTS "Build the unitary tests" ON) OPTION(INSTALL_DOCUMENTATION "Generate and install the documentation" FALSE)
OPTION(BUILD_UNIT_TESTS "Build the unitary tests" OFF)
IF(BUILD_UNIT_TESTS)
SET(DISABLE_TESTS OFF)
ELSE(BUILD_UNIT_TESTS)
SET(DISABLE_TESTS ON)
ENDIF(BUILD_UNIT_TESTS)
FINDPYTHON() FINDPYTHON()
......
...@@ -3,15 +3,20 @@ ...@@ -3,15 +3,20 @@
# Copyright (c) 2018-2019 INRIA # Copyright (c) 2018-2019 INRIA
# #
MACRO(ADD_LIB_UNIT_TEST test PKGS) MACRO(ADD_LIB_UNIT_TEST test PKGS)
CREATE_CTEST_BUILD_TESTS_TARGET()
IF (BUILD_UNIT_TESTS) IF (BUILD_UNIT_TESTS)
ADD_LIBRARY(${test} SHARED ${test}) ADD_LIBRARY(${test} SHARED ${test})
ELSE (BUILD_UNIT_TESTS) ELSE (BUILD_UNIT_TESTS)
ADD_LIBRARY(${test} SHARED EXCLUDE_FROM_ALL ${test}) ADD_LIBRARY(${test} SHARED EXCLUDE_FROM_ALL ${test})
ENDIF (BUILD_UNIT_TESTS) ENDIF (BUILD_UNIT_TESTS)
FOREACH(PKG ${PKGS}) FOREACH(PKG ${PKGS})
PKG_CONFIG_USE_DEPENDENCY(${test} ${PKG}) PKG_CONFIG_USE_DEPENDENCY(${test} ${PKG})
ENDFOREACH(PKG) ENDFOREACH(PKG)
TARGET_LINK_LIBRARIES(${test} ${PROJECT_NAME}) TARGET_LINK_LIBRARIES(${test} ${PROJECT_NAME})
TARGET_LINK_BOOST_PYTHON(${test}) TARGET_LINK_BOOST_PYTHON(${test})
SET_TARGET_PROPERTIES(${test} PROPERTIES PREFIX "") SET_TARGET_PROPERTIES(${test} PROPERTIES PREFIX "")
...@@ -21,11 +26,13 @@ MACRO(ADD_LIB_UNIT_TEST test PKGS) ...@@ -21,11 +26,13 @@ MACRO(ADD_LIB_UNIT_TEST test PKGS)
SET_TARGET_PROPERTIES(${test} PROPERTIES SUFFIX ".so") SET_TARGET_PROPERTIES(${test} PROPERTIES SUFFIX ".so")
ENDIF(APPLE) ENDIF(APPLE)
ADD_TEST(NAME ${test} COMMAND ${PYTHON_EXECUTABLE} -c "import ${test}") ADD_TEST(${test} COMMAND ${PYTHON_EXECUTABLE} -c "import ${test}")
ADD_DEPENDENCIES(check ${test})
ENDMACRO(ADD_LIB_UNIT_TEST)
ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND}) ADD_DEPENDENCIES(build_tests ${test})
IF(DISABLE_TESTS)
SET_TESTS_PROPERTIES(${test} PROPERTIES DEPENDS ctest_build_tests)
ENDIF(DISABLE_TESTS)
ENDMACRO(ADD_LIB_UNIT_TEST)
ADD_LIB_UNIT_TEST(matrix "eigen3") ADD_LIB_UNIT_TEST(matrix "eigen3")
ADD_LIB_UNIT_TEST(geometry "eigen3") ADD_LIB_UNIT_TEST(geometry "eigen3")
......
Supports Markdown
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