mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-09 21:24:14 +00:00
d1b62bc7c1
Previously we maintained three types of builds: a fully internal BUCK build, a CMake build with modifications to use things from an internal toolchain, and an open source CMake build. As far as I'm concerned the intermediate build is not useful because our source is readily available in both an internal and external form. Use cases as follows: 1. BUCK build for distributing widely. 2. BUCK build for getting a static binary that can be run on any machine. 3. CMake build for primary development. 4. CMake build for external CI. With the internal update to CentOS Stream 9 an unmodified CMake build now works readily. This change patches up some things that were relying on system headers that should have been vendored and cleans up drgn dependencies. Test plan: - It builds. - TODO: Document CentOS 9 installation.
44 lines
1.3 KiB
CMake
44 lines
1.3 KiB
CMake
# Set a default build type if none was specified
|
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
|
|
set(CMAKE_BUILD_TYPE
|
|
RelWithDebInfo
|
|
CACHE STRING "Choose the type of build." FORCE)
|
|
# Set the possible values of build type for cmake-gui, ccmake
|
|
set_property(
|
|
CACHE CMAKE_BUILD_TYPE
|
|
PROPERTY STRINGS
|
|
"Debug"
|
|
"Release"
|
|
"MinSizeRel"
|
|
"RelWithDebInfo")
|
|
endif()
|
|
|
|
# Generate compile_commands.json to make it easier to work with clang based tools
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
|
|
|
|
option(ENABLE_IPO "Enable Interprocedural Optimization, aka Link Time Optimization (LTO)" OFF)
|
|
|
|
if(ENABLE_IPO)
|
|
include(CheckIPOSupported)
|
|
check_ipo_supported(
|
|
RESULT
|
|
result
|
|
OUTPUT
|
|
output)
|
|
if(result)
|
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
|
else()
|
|
message(SEND_ERROR "IPO is not supported: ${output}")
|
|
endif()
|
|
endif()
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
|
|
add_compile_options(-fcolor-diagnostics)
|
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
add_compile_options(-fdiagnostics-color=auto)
|
|
else()
|
|
message(STATUS "No colored compiler diagnostic set for '${CMAKE_CXX_COMPILER_ID}' compiler.")
|
|
endif()
|
|
|