forked from rraju1/cmake-buildscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AmberBuildSystemInit.cmake
73 lines (54 loc) · 3.4 KB
/
AmberBuildSystemInit.cmake
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
# This file contains code which must run to start up the build system, and includes files that are common to Amber and every submodule.
# This file must run AFTER a project() command without any languages, but BEFORE the enable_language() command
if(NOT DEFINED FIRST_RUN)
# create a cache variable which is shadowed by a local variable
set(FIRST_RUN FALSE CACHE INTERNAL "Variable to track if it is currently the first time the build system is run" FORCE)
set(FIRST_RUN TRUE)
endif()
# print header
# --------------------------------------------------------------------
message(STATUS "**************************************************************************")
message(STATUS "Starting configuration of ${PROJECT_NAME} version ${${PROJECT_NAME}_VERSION}...")
# print CMake version at the start so we can use it to diagnose issues even if the configure fails
message(STATUS "CMake Version: ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}")
message(STATUS "For how to use this build system, please read this wiki:")
message(STATUS " http://ambermd.org/pmwiki/pmwiki.php/Main/CMake")
message(STATUS "For a list of important CMake variables, check here:")
message(STATUS " http://ambermd.org/pmwiki/pmwiki.php/Main/CMake-Common-Options")
message(STATUS "**************************************************************************")
# fix search path so that libraries from the install tree are not used
# --------------------------------------------------------------------
list(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}")
# eliminate extraneous install messages
# --------------------------------------------------------------------
set(CMAKE_INSTALL_MESSAGE LAZY)
# configure module path
# --------------------------------------------------------------------
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}
"${CMAKE_CURRENT_LIST_DIR}/jedbrown"
"${CMAKE_CURRENT_LIST_DIR}/hanjianwei"
"${CMAKE_CURRENT_LIST_DIR}/rpavlik"
"${CMAKE_CURRENT_LIST_DIR}/patched-cmake-modules")
# prevent obliteration of the old build system's makefiles
# --------------------------------------------------------------------
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "You are building in the source directory. ${PROJECT_NAME} does not support this, since it would obliterate the Makefile build system.")
endif()
# includes
# --------------------------------------------------------------------
#Basic utilities. These files CANNOT use any sort of compile checks or system introspection because no languages are enabled yet
include(CMakeParseArguments)
include(Utils)
include(Shorthand)
include(ColorMessage)
include(Policies)
# get install directories
include(InstallDirs)
#run manual compiler setter, if it is enabled
include(AmberCompilerConfig)
#control default build type.
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Allowed build types for Amber. This only controls debugging flags, set the OPTIMIZE variable to control compiler optimizations." FORCE)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Type of build. Controls debugging information and optimizations." FORCE)
endif()