1 # Defines the gtest & gtest_main libraries. User tests should link
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}
9 COMPILE_FLAGS "${cxx_flags}")
10 if (BUILD_SHARED_LIBS OR type STREQUAL "SHARED")
11 set_target_properties(${name}
13 COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1")
15 if (CMAKE_USE_PTHREADS_INIT)
16 target_link_libraries(${name} ${CMAKE_THREAD_LIBS_INIT})
20 ########################################################################
22 # Helper functions for creating build targets.
24 function(cxx_library name cxx_flags)
25 cxx_library_with_type(${name} "" "${cxx_flags}" ${ARGN})
29 set(GROMACS_CXX_FLAGS "${GROMACS_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
31 add_executable(domains domains.cpp domaintype.cpp newfit.cpp)
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})
40 cxx_library(gtest "${cxx_strict}" gtest/src/gtest-all.cc)
41 add_executable(domaintests domaintests.cpp domaintype.cpp newfit.cpp)
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)