From: mpech Date: Mon, 20 Jun 2011 13:29:07 +0000 (+0200) Subject: use of find_xxx to find googleframework and data paths X-Git-Tag: v1.3.0~319 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=8b3d180dd8def085f04c9db88d833e81794c0abf;p=clitk.git use of find_xxx to find googleframework and data paths --- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d4deb75..fcacae0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,7 +1,8 @@ cmake_policy(SET CMP0005 NEW) - - +#========================================================= +# Google test macro macro(ADD_GOOGLE_TESTS executable) +message(exe : ${executable}) foreach ( source ${ARGN} ) file(READ "${source}" contents) string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) @@ -11,23 +12,27 @@ macro(ADD_GOOGLE_TESTS executable) endforeach(hit) endforeach() endmacro() +#========================================================= +#========================================================= SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/tests/bin) SET(BUILDNAME ${CMAKE_SYSTEM_NAME}${CMAKE_OSX_ARCHITECTURES} CACHE INTERNAL DOCSTRING) -SET(CLITK_DATA_PATH ${PROJECT_SOURCE_DIR}/tests/data/ CACHE STRING "dataTest path") -#todo test if data test path exists +#========================================================= +#========================================================= +# Data tests path +FIND_PATH(CLITK_DATA_PATH data) ADD_DEFINITIONS(-DCLITK_DATA_PATH=\"${CLITK_DATA_PATH}\") +#========================================================= +#========================================================= +# GoogleTest framemwork +FIND_PATH(GTEST_DIR gtest) +INCLUDE_DIRECTORIES(${GTEST_DIR}/include/) -add_library(gtest UNKNOWN IMPORTED) -set(GTEST_DIR ${ITK_DIR}/../gtest/ CACHE STRING "gtestDir") -if(WIN32) - SET(gtestLibName gtest.lib) -else(UNIX) - SET(gtestLibName libgtest.a) -endif(WIN32) -set(GTEST_LIB ${GTEST_DIR}/build/${gtestLibName}) -set_property(TARGET gtest PROPERTY IMPORTED_LOCATION "${GTEST_LIB}") -include_directories(${GTEST_DIR}/include/) - +FIND_LIBRARY(GTEST_LIB NAMES gtest PATHS ${GTEST_DIR}/build/) +ADD_LIBRARY(gtest UNKNOWN IMPORTED) +SET_PROPERTY(TARGET gtest PROPERTY IMPORTED_LOCATION "${GTEST_LIB}") +#========================================================= +#========================================================= +# Enabled options to test IF(CLITK_BUILD_TOOLS) ADD_SUBDIRECTORY(tools) ENDIF() @@ -42,5 +47,5 @@ ENDIF() # ADD_SUBDIRECTORY(registration) # ENDIF() #ADD_SUBDIRECTORY(common) - +#========================================================= diff --git a/tests/tools/CMakeLists.txt b/tests/tools/CMakeLists.txt index ad57d59..8c6c282 100644 --- a/tests/tools/CMakeLists.txt +++ b/tests/tools/CMakeLists.txt @@ -11,4 +11,5 @@ target_link_libraries(toolsTest vvLib ${vvExternalLibs} gtest) # Add all tests found in the source code, calling the executable to run them add_google_tests ( ${EXECUTABLE_OUTPUT_PATH}/toolsTest ${srcs}) + SET(BUILDNAME ${BUILDNAME}_tools CACHE INTERNAL DOCSTRING) \ No newline at end of file diff --git a/tests/vv/vvRegisterFormTest.cxx b/tests/vv/vvRegisterFormTest.cxx index 836f32d..15d88c4 100644 --- a/tests/vv/vvRegisterFormTest.cxx +++ b/tests/vv/vvRegisterFormTest.cxx @@ -22,7 +22,7 @@ #include "vvConfiguration.h" #include #include -const std::string data_path = "/home/mpech/workspace/vvSource/tests/data/"; +const std::string data_path = CLITK_DATA_PATH; TEST(vvRegisterForm, canPush){ QUrl url; //the file exists with some old lines