@@ -394,7 +394,6 @@ endif()
394394
395395if (BUILD_TESTS)
396396 message (STATUS "Tests enabled. Run with make check" )
397- add_subdirectory (tests/googletest/googletest )
398397
399398 set (TEST_SRCS
400399 tests/test_station.cpp
@@ -409,15 +408,12 @@ if (BUILD_TESTS)
409408 # test_daily.cpp
410409 tests/test_triangulation.cpp
411410 tests/main.cpp
412- )
413-
411+ )
414412
415- set ( GTEST_LINK
416- gtest
413+ set (GTEST_LINK
414+ GTest:: gtest
417415 )
418416
419-
420-
421417 add_executable (
422418 runUnitTests
423419 ${CHM_SRCS}
@@ -455,32 +451,6 @@ if (BUILD_TESTS)
455451 DEPENDS runUnitTests
456452 WORKING_DIRECTORY ${TEST_DIR} )
457453
458- if (BUILD_WITH_CONAN)
459- if (APPLE )
460- add_custom_command (TARGET runUnitTests POST_BUILD
461- #patch CHM to look for @rpath/ for all dylibs that aren't looking for @rpath
462- COMMAND bash -c "otool -l ${TEST_DIR} /runUnitTests | grep name | grep -v segname | grep -v sectname | grep -v @rpath | awk '{print $2}' | grep -v '^/' | while read x; do install_name_tool -change $x @rpath/`echo $x | grep -Eo '[a-zA-Z0-9_\. -]+\. dylib'` ${TEST_DIR} /runUnitTests; done"
463- #strip all LC_RPATH from our non-install binary
464- COMMAND bash -c "otool -l ${TEST_DIR} /runUnitTests | grep LC_RPATH -A2 | grep path | awk '{print $2}' | while read x; do install_name_tool -delete_rpath $x ${TEST_DIR} /runUnitTests; done"
465- #update LC_RPATH for our non-install binary
466- COMMAND bash -c "install_name_tool -add_rpath @executable_path/../lib ${TEST_DIR} /runUnitTests"
467- VERBATIM )
468- else ()
469- target_link_options (runUnitTests
470- PUBLIC "LINKER:--disable-new-dtags" )
471-
472- add_custom_command (TARGET runUnitTests POST_BUILD
473- # # Some .so will have runpaths, some do not. Just remove them all. The RUNPATHS override the binarie's rpath (I don't know why)
474- COMMAND bash -c "cd ${CMAKE_BINARY_DIR } /lib ; ls | while read x; do patchelf --remove-rpath $x; done"
475- #
476- # # RPATH correctly works, so unlikely to be needed but kept just in case.
477- # # This removes all runpaths , and then here we will patch each .so to have the correct RUNPATH
478- COMMAND bash -c "cd ${CMAKE_BINARY_DIR } /lib ; ls | while read x; do patchelf --set-rpath '\$ ORIGIN/../lib' $x; done"
479-
480- VERBATIM
481- )
482- endif ()
483- endif ()
484454
485455 #copy the data files from test_data to the dir that holds the test binary
486456 add_custom_command (TARGET runUnitTests PRE_BUILD
@@ -490,5 +460,4 @@ if (BUILD_TESTS)
490460 COMMENT "Copying files to $<TARGET_FILE_DIR :runUnitTests > from ${CMAKE_SOURCE_DIR } /test_data/" )
491461
492462
493-
494463endif ()
0 commit comments