Вернул, как было
[alexxy/gromacs-dssp.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.16.3)
2
3 project(gromacs-dssp CXX)
4
5 set(CMAKE_CXX_STANDARD 17)  # new
6 set(CMAKE_CXX_STANDARD_REQUIRED ON) # new
7 set(CMAKE_CXX_EXTENSIONS OFF) # new
8
9 if (NOT CMAKE_BUILD_TYPE)
10     set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
11 endif()
12
13 # CMake modules are in a subdirectory to keep this file cleaner
14 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
15
16 #set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) # disabled
17 #set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) # disabled
18 #set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) # disabled
19
20 # In principle, this could be deduced from GROMACS_IS_DOUBLE returned by
21 # find_package(GROMACS) based on the suffix alone, but it is clearer that the
22 # user explicitly sets what they want to get, and then need to provide a suffix
23 # to match.
24 option(GMX_DOUBLE "Use double precision" OFF)
25 set(GMX_SUFFIX "" CACHE STRING "Suffix for the GROMACS installation to use (empty for default)")
26
27 # This does not allow for a non-suffixed double-precision libgromacs, but
28 # that should be rare enough for demonstration purposes.
29 if (GMX_DOUBLE AND NOT GMX_SUFFIX)
30     set(GROMACS_SUFFIX "_d")
31 else()
32     set(GROMACS_SUFFIX ${GMX_SUFFIX})
33 endif()
34
35 find_package(GROMACS 2020 REQUIRED)
36 gromacs_check_double(GMX_DOUBLE)
37 gromacs_check_compiler(CXX)
38 include_directories(${GROMACS_INCLUDE_DIRS}) # new
39 add_definitions(${GROMACS_DEFINITIONS})
40
41 # Use static linking on MSVC
42 if (CMAKE_GENERATOR MATCHES "Visual Studio")
43     string(REPLACE /MD /MT CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
44     set(CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} CACHE STRING "" FORCE)
45     string(REPLACE /MD /MT CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
46     set(CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG} CACHE STRING "" FORCE)
47 endif()
48
49 add_subdirectory(src)
50
51 #add_executable(dssp dssp.cpp)
52 #set_target_properties(dssp PROPERTIES
53                       #COMPILE_FLAGS "${GROMACS_CXX_FLAGS}")
54 #target_link_libraries(dssp ${GROMACS_LIBRARIES})