-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
53 lines (45 loc) · 1.67 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Shamelessly stolen from jeffmm/simcore project
cmake_minimum_required(VERSION 3.13)
project(cylaks
VERSION 1.0
DESCRIPTION "A C++ Cytoskeleton lattice-based kinetic simulator"
LANGUAGES CXX
)
# Only do these if this is the main project, and not if it is included through add_subdirectory
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
# Ensure -std=c++xx instead of -std=g++xx
set(CMAKE_CXX_EXTENSIONS OFF)
# specify C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# specify compiler build type
if(DEBUG)
set(CMAKE_BUILD_TYPE "Debug")
else()
set(CMAKE_BUILD_TYPE "Release")
# Check if compiler supports -march=native flag; add it if so
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
endif()
# Need this linker flag to use std::filesystem library
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++fs")
# Support for folders in IDEs
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Require out-of-source builds
file(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" LOC_PATH)
if(EXISTS "${LOC_PATH}")
message(FATAL_ERROR "You cannot build in a source directory (or any directory with a CMakeLists.txt file). Please make a build subdirectory. Feel free to remove CMakeCache.txt and CMakeFiles.")
endif()
#include(CTest)
# find_package(Doxygen)
# if(Doxygen_FOUND)
# add_subdirectory(docs)
# else()
# message(STATUS "Doxygen not found, not building docs")
# endif()
endif()
# add source directory
add_subdirectory(src)