-
Notifications
You must be signed in to change notification settings - Fork 34
/
CMakeLists.txt
61 lines (50 loc) · 1.73 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
cmake_minimum_required(VERSION 3.4)
project(squirrel VERSION 4.0 LANGUAGES C CXX)
option(ENABLE_VAR_TRACE "Enable variable change tracing feature.")
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif ()
include(GNUInstallDirs)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_CXX_STANDARD 17)
if(CMAKE_COMPILER_IS_GNUCXX)
add_compile_options(
"$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti;-fno-exceptions>"
-fno-strict-aliasing
-Wall
-Wextra
-pedantic
-Wcast-qual
"$<$<CONFIG:Release>:-O3>"
"$<$<CONFIG:RelWithDebInfo>:-O3;-g>"
"$<$<CONFIG:MinSizeRel>:-Os>"
"$<$<CONFIG:Debug>:-pg;-pie;-gstabs;-g3;-Og>"
)
elseif(MSVC)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
add_subdirectory(squirrel)
add_subdirectory(sqstdlib)
add_subdirectory(sqmodules)
add_subdirectory(sq)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(tgts)
list(APPEND tgts squirrel sqstdlib sqmodules sq)
foreach(t ${tgts})
target_compile_definitions(${t} PUBLIC -D_SQ64)
endforeach()
endif()
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/squirrel/squirrel-config-version.cmake"
VERSION "${squirrel_VERSION}"
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/squirrel-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/cmake/squirrel/squirrel-config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/squirrel"
)