1 cmake_minimum_required(VERSION 2.6)
5 # Cmake modules/macros are in a subdirectory to keep this file cleaner
6 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
8 if(NOT CMAKE_BUILD_TYPE)
9 set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
10 endif(NOT CMAKE_BUILD_TYPE)
15 option(GMX_DOUBLE "Use double precision" OFF)
17 ########################################################################
18 # Fix stupid flags on MSVC
19 ########################################################################
20 IF(CMAKE_GENERATOR MATCHES "Visual Studio")
21 STRING(REPLACE /MD /MT CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
22 SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} CACHE STRING "" FORCE)
23 STRING(REPLACE /MD /MT CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
24 SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG} CACHE STRING "" FORCE)
25 ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
27 ########################################################################
28 # Basic system tests (standard libraries, headers, functions, types) #
29 ########################################################################
37 #only check for libmd, because it depends on libgmx
38 FIND_PACKAGE(PkgConfig)
39 #do not use REQUIRED here, we have a better error message then pkgconfig
40 PKG_CHECK_MODULES(LIBMD ${LIBMD})
42 message(FATAL_ERROR "${LIBMD} not found, source GMXRC.")
43 endif (NOT LIBMD_FOUND)
44 add_definitions( ${LIBMD_CFLAGS} )
45 include_directories( ${LIBMD_INCLUDE_DIRS} )
46 link_directories( ${LIBMD_LIBRARY_DIRS} )
49 ########################################################################
50 # Specify install locations and which subdirectories to process #
51 ########################################################################
52 set(BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin)
54 add_executable(template template.c)
55 target_link_libraries(template ${LIBMD_LIBRARIES})