cmake_minimum_required(VERSION 2.8.8) project(gromacs-spacetimecorr CXX) if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) endif() # CMake modules are in a subdirectory to keep this file cleaner list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) # In principle, this could be deduced from GROMACS_IS_DOUBLE returned by # find_package(GROMACS) based on the suffix alone, but it is clearer that the # user explicitly sets what they want to get, and then need to provide a suffix # to match. option(GMX_DOUBLE "Use double precision" OFF) option(GMX_OPENMP "Enable OpenMP-based multithreading" ON) set(GMX_SUFFIX "" CACHE STRING "Suffix for the GROMACS installation to use (empty for default)") # This does not allow for a non-suffixed double-precision libgromacs, but # that should be rare enough for demonstration purposes. if (GMX_DOUBLE AND NOT GMX_SUFFIX) set(GROMACS_SUFFIX "_d") else() set(GROMACS_SUFFIX ${GMX_SUFFIX}) endif() find_package(GROMACS 2016 REQUIRED) gromacs_check_double(GMX_DOUBLE) gromacs_check_compiler(CXX) include(gmxManageOpenMP) add_definitions(${GROMACS_DEFINITIONS}) # Use static linking on MSVC if (CMAKE_GENERATOR MATCHES "Visual Studio") string(REPLACE /MD /MT CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE}) set(CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} CACHE STRING "" FORCE) string(REPLACE /MD /MT CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) set(CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG} CACHE STRING "" FORCE) endif() if(NOT GMX_OPENMP) #Unset all OpenMP flags in case OpenMP was disabled either by the user #or because it was only partially detected (e.g. only for C but not C++ compiler) unset(OpenMP_C_FLAGS CACHE) unset(OpenMP_CXX_FLAGS CACHE) endif() add_subdirectory(src)