This repository has been archived by the owner on Dec 14, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
CMakeLists.txt
84 lines (70 loc) · 2.7 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
cmake_minimum_required(VERSION 2.8)
#######################################
# PROJECT INFORMATION #
#-------------------------------------#
# This CMakeLists.txt file is for the #
# CoolProp thermodynamic library #
# written by Ian Bell. The following #
# section contains project and #
# version information. #
#######################################
# Project name
set(project_name "CoolProp")
set(app_name ${project_name})
project(${project_name})
#######################################
# BUILD OPTIONS #
#-------------------------------------#
# These options are available to be #
# modified in the build process. #
# packages may want to modify these #
# to suit, or just leave as defaults. #
#######################################
option (COOLPROP_STATIC_LIBRARY
"Build and install CoolProp as a STATIC library (.lib, .a) as opposed to SHARED (.dll, .so)"
ON)
#######################################
# FIND ALL SOURCES #
#-------------------------------------#
# The project is organised with #
# split includes and source folders #
# this makes it easier for developers #
# to quickly find relevant includes. #
# This section finds all sources, #
# headers and corrosponding dirs. #
#######################################
message(STATUS ${CMAKE_CURRENT_SOURCE_DIR})
file(GLOB APP_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/${project_name}/*.cpp")
file(GLOB APP_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/${project_name}/*.h")
set (APP_INCLUDE_DIRS "")
foreach (_headerFile ${APP_HEADERS})
get_filename_component(_dir ${_headerFile} PATH)
list (APPEND APP_INCLUDE_DIRS ${_dir})
endforeach()
list(REMOVE_DUPLICATES APP_INCLUDE_DIRS)
include_directories(${APP_INCLUDE_DIRS})
#######################################
# REQUIRED MODULES #
#-------------------------------------#
# CoolProp requires some standard OS #
# features, these include: #
# DL (CMAKE_DL_LIBS) for REFPROP #
#######################################
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/dev/cmake/Modules/")
if(UNIX)
find_package (${CMAKE_DL_LIBS} REQUIRED)
endif()
#######################################
# MAKE ARTIFACTS #
#-------------------------------------#
# In this section we define the #
# artifacts (exes, libs) that will be #
# made for coolprop, these include #
# customisation from earier options. #
#######################################
### COOLPROP LIB or DLL ###
if (COOLPROP_STATIC_LIBRARY)
add_library(${app_name} STATIC ${APP_SOURCES})
else()
add_library(${app_name} SHARED ${APP_SOURCES})
endif()