diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bf4748..1dc6fd9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,10 +44,21 @@ ENDIF (NOT BUILD_PY_LIB) add_subdirectory(src/outfile) IF (BUILD_TESTING) - enable_testing() - add_subdirectory(tests) - add_subdirectory(tests/outfile) - add_subdirectory(tests/util) + #Prep ourselves for compiling boost + IF(WIN32) + set(Boost_USE_STATIC_LIBS ON) + ELSE(TRUE) + set(Boost_USE_STATIC_LIBS OFF) + add_definitions(-DBOOST_ALL_DYN_LINK) + ENDIF(WIN32) + + find_package(Boost COMPONENTS unit_test_framework system thread filesystem) + include_directories (${Boost_INCLUDE_DIRS}) + + enable_testing() + add_subdirectory(tests) + add_subdirectory(tests/outfile) + add_subdirectory(tests/util) ENDIF (BUILD_TESTING) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b91c02f..8028eef 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,8 +7,6 @@ # US EPA ORD/NRMRL # -#Setup CMake to run tests -enable_testing() # Sets for output directory for executables and libraries. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) @@ -17,18 +15,6 @@ if(UNIX) set(CMAKE_CXX_FLAGS "-std=c++11") endif(UNIX) -#Prep ourselves for compiling boost -IF(WIN32) - set(Boost_USE_STATIC_LIBS ON) -ELSE(TRUE) - set(Boost_USE_STATIC_LIBS OFF) - add_definitions(-DBOOST_ALL_DYN_LINK) -ENDIF(WIN32) - -set(Boost_THREAD_FOUND OFF) -find_package(Boost COMPONENTS unit_test_framework system thread filesystem) -include_directories (${Boost_INCLUDE_DIRS}) - set(toolkit_test_srcs test_toolkit.cpp diff --git a/tests/outfile/CMakeLists.txt b/tests/outfile/CMakeLists.txt index 84e00a4..c9d7fc0 100644 --- a/tests/outfile/CMakeLists.txt +++ b/tests/outfile/CMakeLists.txt @@ -1,28 +1,14 @@ -enable_testing() - # Sets for output directory for executables and libraries set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) -#Prep ourselves for compiling boost -IF(WIN32) - set(Boost_USE_STATIC_LIBS ON) -ELSE(TRUE) - set(Boost_USE_STATIC_LIBS OFF) - add_definitions(-DBOOST_ALL_DYN_LINK) -ENDIF(WIN32) - -find_package(Boost COMPONENTS unit_test_framework) -include_directories (${Boost_INCLUDE_DIRS} ../../src/outfile/include) - - add_executable(test_output test_output.cpp) - +target_include_directories(test_output PUBLIC ../../src/outfile/include) target_link_libraries(test_output ${Boost_LIBRARIES} epanet-output) add_test(NAME test_output diff --git a/tests/util/CMakeLists.txt b/tests/util/CMakeLists.txt index 27f33c8..713f113 100644 --- a/tests/util/CMakeLists.txt +++ b/tests/util/CMakeLists.txt @@ -1,32 +1,19 @@ -enable_testing() - # Sets for output directory for executables and libraries set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) -#Prep ourselves for compiling boost -IF(WIN32) - set(Boost_USE_STATIC_LIBS ON) -ELSE(TRUE) - set(Boost_USE_STATIC_LIBS OFF) - add_definitions(-DBOOST_ALL_DYN_LINK) -ENDIF(WIN32) - -find_package(Boost COMPONENTS unit_test_framework) -include_directories (${Boost_INCLUDE_DIRS} ../../src/) - set (test_source ./test_errormanager.cpp ../../src/util/errormanager.c ) add_executable(test_errormanager ${test_source}) - +target_include_directories(test_errormanager PUBLIC ../../src/) target_link_libraries(test_errormanager ${Boost_LIBRARIES}) add_test(NAME test_errormanager