- minor tests fixes
[alexxy/gromacs-domains.git] / src / CMakeLists.txt
1 # Defines the gtest & gtest_main libraries.  User tests should link
2 # with one of them.
3 function(cxx_library_with_type name type cxx_flags)
4   # type can be either STATIC or SHARED to denote a static or shared library.
5   # ARGN refers to additional arguments after 'cxx_flags'.
6   add_library(${name} ${type} ${ARGN})
7   set_target_properties(${name}
8     PROPERTIES
9     COMPILE_FLAGS "${cxx_flags}")
10   if (BUILD_SHARED_LIBS OR type STREQUAL "SHARED")
11     set_target_properties(${name}
12       PROPERTIES
13       COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1")
14   endif()
15   if (CMAKE_USE_PTHREADS_INIT)
16     target_link_libraries(${name} ${CMAKE_THREAD_LIBS_INIT})
17   endif()
18 endfunction()
19
20 ########################################################################
21 #
22 # Helper functions for creating build targets.
23
24 function(cxx_library name cxx_flags)
25   cxx_library_with_type(${name} "" "${cxx_flags}" ${ARGN})
26 endfunction()
27
28
29 set(GROMACS_CXX_FLAGS "${GROMACS_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
30
31 add_executable(domains domains.cpp domaintype.cpp newfit.cpp)
32 include_directories(
33         ${GROMACS_INCLUDE_DIRS}
34         ${CMAKE_SOURCE_DIR}/include)
35 set_target_properties(domains PROPERTIES
36         COMPILE_FLAGS "${GROMACS_CXX_FLAGS}")
37 target_link_libraries(domains ${GROMACS_LIBRARIES} ${OpenMP_CXX_LIBRARIES})
38
39
40 cxx_library(gtest "${cxx_strict}" gtest/src/gtest-all.cc)
41 add_executable(domaintests domaintests.cpp domaintype.cpp newfit.cpp)
42 include_directories(
43         ${GROMACS_INCLUDE_DIRS}
44         ${CMAKE_SOURCE_DIR}/include
45         ${CMAKE_SOURCE_DIR}/src/gtest/include
46         ${CMAKE_SOURCE_DIR}/src/gtest)
47 target_link_libraries(domaintests ${GROMACS_LIBRARIES} ${OpenMP_CXX_LIBRARIES} gtest)