-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
53 lines (42 loc) · 1.8 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
cmake_minimum_required (VERSION 3.0)
project(APLCONpp CXX Fortran)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/Modules)
# set also default CMAKE_BUILD_TYPE to Release
include(ConfigSafeGuards)
if((CMAKE_CXX_COMPILER_ID MATCHES GNU) OR (CMAKE_CXX_COMPILER_ID MATCHES Clang)
AND (CMAKE_Fortran_COMPILER_ID MATCHES GNU))
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(DEBUG_FLAGS "-O0 -Wall -Wextra")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_FLAGS}")
set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${DEBUG_FLAGS}")
# suppress warnings in release mode (just not to confuse people)
set(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} -w")
else()
message(FATAL_ERROR "Only GNU/Clang CXX and GNU Fortran compiler supported")
endif()
# figure out compile flags
string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
set(DEFAULT_CXX_COMPILE_FLAGS ${CMAKE_CXX_FLAGS_${BUILD_TYPE}})
set(DEFAULT_Fortran_COMPILE_FLAGS ${CMAKE_Fortran_FLAGS_${BUILD_TYPE}})
message(STATUS "*** Build Type: " ${CMAKE_BUILD_TYPE})
message(STATUS "*** Compiler Flags (CXX): " ${DEFAULT_CXX_COMPILE_FLAGS})
message(STATUS "*** Compiler Flags (Fortran): " ${DEFAULT_Fortran_COMPILE_FLAGS})
add_subdirectory(APLCON)
add_library(aplcon++ SHARED
src/APLCON.hpp src/detail/APLCON_hpp.hpp
src/wrapper/APLCON.f90 src/wrapper/APLCON.h
$<TARGET_OBJECTS:aplcon>)
# Benchmarking business
option(EnableBenchmark "Build benchmark binaries" OFF)
if(EnableBenchmark)
set(BENCHMARK_ENABLE_TESTING OFF)
include(ConfigGBench)
add_subdirectory(bench)
endif()
# enable testing at top-level to make it available to CTest
enable_testing()
# use some concurrency for tests
if(NOT CTEST_PARALLEL_JOBS)
set(CTEST_PARALLEL_JOBS 2)
endif()
add_subdirectory(test)