forked from SINTEF-Geometry/SISL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
88 lines (66 loc) · 2.16 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
PROJECT(sisl)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# Organize the project in folders (VS only?)
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
# Include directories
INCLUDE_DIRECTORIES(
${sisl_SOURCE_DIR}/include
)
# Make the sisl library
FILE(GLOB sisl_SRCS src/*.c include/*.h)
ADD_LIBRARY(sisl ${sisl_SRCS})
SET_PROPERTY(TARGET sisl
PROPERTY FOLDER "sisl/Libs")
# This line may be needed only on AMD 64 bit...
#IF(NOT WIN32)
# SET_TARGET_PROPERTIES(sisl PROPERTIES COMPILE_FLAGS "-fPIC")
#ENDIF(NOT WIN32)
# Set various compiler flags
IF(CMAKE_COMPILER_IS_GNUXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unused-but-set-variable -fPIC")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unused-but-set-variable -fPIC")
ENDIF(CMAKE_COMPILER_IS_GNUXX)
IF(WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP8 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP8 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS")
ENDIF(WIN32)
# Apps, examples, tests, ...?
FILE(GLOB sisl_APPS app/*.C)
FOREACH(app ${sisl_APPS})
GET_FILENAME_COMPONENT(appname ${app} NAME_WE)
ADD_EXECUTABLE(${appname} ${app})
TARGET_LINK_LIBRARIES(${appname} sisl)
SET_PROPERTY(TARGET ${appname}
PROPERTY FOLDER "sisl/Apps")
ENDFOREACH(app)
# 'install' target
IF(WIN32)
# Windows
SET(CMAKE_INSTALL_PREFIX CACHE INTERNAL "")
SET(sisl_INSTALL_PREFIX "$ENV{PROGRAMFILES}/SINTEF/sisl"
CACHE PATH "Path to install SISL")
INSTALL(TARGETS sisl DESTINATION ${sisl_INSTALL_PREFIX}/lib)
INSTALL(DIRECTORY include/
DESTINATION ${sisl_INSTALL_PREFIX}/include
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)
ELSE(WIN32)
# Linux
# lib
INSTALL(TARGETS sisl DESTINATION lib COMPONENT sisl)
# include
INSTALL(DIRECTORY include/
COMPONENT sisl-dev
DESTINATION include
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)
ENDIF(WIN32)
# CPack stuff
IF(NOT GoTools_ALL_COMPILE)
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "sisl-4.6.0")
SET(CPACK_SOURCE_IGNORE_FILES "/CVS/;/\\.svn/;\\.swp$;\\.#;/#;.*~")
INCLUDE(CPack)
ENDIF(NOT GoTools_ALL_COMPILE)
SET(CPACK_STRIP_FILES ${CPACK_STRIP_FILES} libsisl.so)