-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCMakeLists.txt
69 lines (58 loc) · 2.24 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
cmake_minimum_required(VERSION 2.8)
project(squeeze)
# If you want to override compiler please uncomment the line below
#SET(CMAKE_C_COMPILER pathto/mycompiler)
set(CMAKE_BUILD_TYPE release)
# Set some CMake properties:
SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
#include_directories(${CMAKE_SOURCE_DIR}/include)
# Check for compatibility with C11 and OpenMP
# Compile with C11 support.
include(CheckCCompilerFlag)
CHECK_C_COMPILER_FLAG("-std=c11" COMPILER_SUPPORTS_C11)
if(COMPILER_SUPPORTS_C11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
else()
message(STATUS "Your compiler (${CMAKE_C_COMPILER}) has no C11 support. If you are using clang on Apple OS X, please switch to gcc (version > 4.7) which is compliant with the C11 standard.")
endif()
# Compile with OpenMP support
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
else()
message(STATUS "The compiler ${CMAKE_C_COMPILER} has no OpenMP 3.x support, and if you want to use OpenMP capabilities you will need to switch to a different compiler. gcc > 4.7 and clang > 3.7 both support OpenMP 3.x. ")
endif()
# We need to compile the following libraries
if(COMPILER_SUPPORTS_C11)
#compile libraries
# rngstreams
include(ExternalProject)
ExternalProject_Add(
librngstreams
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/rngstreams
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lib/rngstreams/configure --silent
BUILD_COMMAND make
BUILD_IN_SOURCE 1
INSTALL_COMMAND ""
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/rngstreams)
set(LIBS ${LIBS} "${CMAKE_CURRENT_SOURCE_DIR}/lib/rngstreams/librngstreams.a")
# cfitsio
ExternalProject_Add(
libcfitsio
DOWNLOAD_COMMAND ""
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/cfitsio
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/lib/cfitsio/configure --silent --disable-curl
CMAKE_ARGS "-DUSE_PTHREADS=ON"
BUILD_COMMAND make all
BUILD_IN_SOURCE 1
INSTALL_COMMAND ""
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib/cfitsio)
set(LIBS ${LIBS} "${CMAKE_CURRENT_SOURCE_DIR}/lib/cfitsio/libcfitsio.a")
# Build the main directory, always
add_subdirectory(src)
else()
message(STATUS "SQUEEZE installation aborted")
endif()