-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
36 lines (28 loc) · 1.1 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
cmake_minimum_required(VERSION "3.10")
#Set target ouput directory
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(VALID_BUILD_TYPES "Release" "Debug" "MinSizeRel" "RelWithDebInfo")
option(BUILD_SHARED_LIBS "True when building a shared library" True)
project("Foo")
#set CMAKE_BUILD_TYPE default value
if(NOT CMAKE_CONFIGURATION_TYPES)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build configuration" FORCE)
endif()
endif()
#validate CMAKE_BUILD_TYPE
if(NOT CMAKE_CONFIGURATION_TYPES)
list(FIND VALID_BUILD_TYPES "${CMAKE_BUILD_TYPE}" INDEX)
if(${INDEX} MATCHES -1)
message(FATAL_ERROR "Invalid build type. Valid types are [${VALID_BUILD_TYPES}]")
endif()
endif()
#Create dropdown list for CMake gui
if(NOT CMAKE_CONFIGURATION_TYPES)
if(DEFINED CMAKE_BUILD_TYPE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${VALID_BUILD_TYPES})
endif()
endif()
add_subdirectory("modules")