-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
executable file
·93 lines (71 loc) · 2.71 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
89
90
91
92
93
################################
# GLOBAL CONFIGURATION VARIABLES
################################
cmake_minimum_required (VERSION 3.7.2)
set (libOL_VERSION_MAJOR 1)
set (libOL_VERSION_MINOR 73)
project (libOL VERSION ${libOL_VERSION_MAJOR}.${libOL_VERSION_MINOR} LANGUAGES C)
option(WITH_CPACK "Enable cpack target to generate a zip file containing binaries" OFF)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
if (CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
set (math_LIBRARIES "m")
endif ()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if (WIN32)
set(CMAKE_INSTALL_PREFIX "$ENV{HOMEPATH}/cmakebuilds" CACHE PATH "..." FORCE)
else ()
set(CMAKE_INSTALL_PREFIX "$ENV{HOME}/cmakebuilds/$ENV{OSTYPE}-$ENV{MACHTYPE}" CACHE PATH "..." FORCE)
endif()
endif ()
list (APPEND CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}")
#######################################
# SET FILES AND DIRECTORIES TO BE BUILT
#######################################
include_directories (${PROJECT_SOURCE_DIR}/sources)
add_subdirectory (sources)
find_package(LPlib 3)
find_package(libMeshb 7)
if(libMeshb_FOUND)
include_directories (${libMeshb_INCLUDE_DIRS})
include_directories (${PROJECT_SOURCE_DIR}/examples)
add_subdirectory (examples)
else()
message (WARNING "
libMeshb.7 could not be found.
Consequently, examples and utilities will not be built.
You can download it from GitHUB at https://github.com/LoicMarechal/libMeshb")
endif()
install (FILES LICENSE.txt copyright.txt DESTINATION share/libOL)
install (DIRECTORY sample_meshes DESTINATION share/libOL)
######################################
# SET PACKAGE AND DEPLOYMENT VARIABLES
######################################
if (WITH_CPACK)
include(CMakeCPack.cmake)
endif ()
######################################
# EXPORT CMAKE PACKAGE INFORMATION
######################################
include(CMakePackageConfigHelpers)
file(WRITE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
"include(\${CMAKE_CURRENT_LIST_DIR}/libOL-target.cmake)
set(libOL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include)
set(libOL_LIBRARIES OL.1)
set(libOL_FOUND TRUE)
")
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)
install(FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION lib/cmake/${PROJECT_NAME})
##################################
# PRINT OPERATIONS TO BE CONDUCTED
##################################
message("-- Build mode : " ${CMAKE_BUILD_TYPE})
message("-- cpack target enabled : " ${WITH_CPACK})
message("-- Install directory : " ${CMAKE_INSTALL_PREFIX})