[BOLT][CMAKE][NFC] Update runtime/CMakeLists.txt

Summary:
- Specify compiler flags for runtime libraries as BOLT_RT_FLAGS,
- Remove redundant CMake definitions.

Reviewers: maksfb

FBD34048561
This commit is contained in:
Amir Ayupov 2022-02-07 11:03:20 -08:00
parent 03f014c9ae
commit c840047c38

View File

@ -1,9 +1,5 @@
cmake_minimum_required(VERSION 3.1.0)
include(CheckIncludeFiles)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
project(libbolt_rt_project)
@ -21,10 +17,16 @@ add_library(bolt_rt_hugify STATIC
${CMAKE_CURRENT_BINARY_DIR}/config.h
)
set(BOLT_RT_FLAGS
-ffreestanding
-fno-exceptions
-fno-rtti
-fno-stack-protector)
# Don't let the compiler think it can create calls to standard libs
target_compile_options(bolt_rt_instr PRIVATE -ffreestanding -fno-exceptions -fno-rtti -fno-stack-protector -fPIE)
target_compile_options(bolt_rt_instr PRIVATE ${BOLT_RT_FLAGS} -fPIE)
target_include_directories(bolt_rt_instr PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_compile_options(bolt_rt_hugify PRIVATE -ffreestanding -fno-exceptions -fno-rtti -fno-stack-protector)
target_compile_options(bolt_rt_hugify PRIVATE ${BOLT_RT_FLAGS})
target_include_directories(bolt_rt_hugify PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
install(TARGETS bolt_rt_instr DESTINATION lib)
@ -38,9 +40,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
target_include_directories(bolt_rt_instr_osx PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_compile_options(bolt_rt_instr_osx PRIVATE
-target x86_64-apple-darwin19.6.0
-ffreestanding
-fno-exceptions
-fno-rtti
-fno-stack-protector)
${BOLT_RT_FLAGS})
install(TARGETS bolt_rt_instr_osx DESTINATION lib)
endif()