[Linux] Switch to Ninja build system. Use compiler feature detection to accomodate the new PCH module.

This commit is contained in:
Router Gray
2019-10-19 22:12:19 -05:00
parent 76e9d912d6
commit 2ba3ff852c
3 changed files with 21 additions and 17 deletions

View File

@@ -5,6 +5,7 @@
if(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)
set(${CMAKE_CURRENT_LIST_FILE}_INCLUDED "YES")
include(CheckCCompilerFlag)
include(Variables)
# Portable compilation flags.
@@ -199,10 +200,13 @@ if (LINUX)
# End of hacks.
if (NOT STANDALONE)
# this stops us requiring a really recent glibc at runtime
add_definitions(-fno-stack-protector)
endif (NOT STANDALONE)
CHECK_C_COMPILER_FLAG(-fstack-protector-strong HAS_STRONG_STACK_PROTECTOR)
if (${CMAKE_BUILD_TYPE} STREQUAL "Release")
if(HAS_STRONG_STACK_PROTECTOR)
add_compile_options(-fstack-protector-strong)
endif(HAS_STRONG_STACK_PROTECTOR)
endif (${CMAKE_BUILD_TYPE} STREQUAL "Release")
if (${ARCH} STREQUAL "x86_64")
add_definitions(-pipe)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffast-math")

View File

@@ -94,7 +94,7 @@ macro(target_precompiled_header TARGET_NAME PRECOMPILED_HEADER PRECOMPILED_SOURC
# Add a custom target for building the precompiled header.
add_custom_command(
OUTPUT ${OUTPUT_NAME}
COMMAND ${CMAKE_CXX_COMPILER} @${PCH_FLAGS_FILE} ${COMPILER_FLAGS} -x c++-header -std=${CXX_STD} -o ${OUTPUT_NAME} ${PRECOMPILED_HEADER}
COMMAND ${CMAKE_CXX_COMPILER} @${PCH_FLAGS_FILE} ${COMPILER_FLAGS} -x c++-header -o ${OUTPUT_NAME} ${PRECOMPILED_HEADER}
DEPENDS ${PRECOMPILED_HEADER})
add_custom_target(${TARGET_NAME}_gch DEPENDS ${OUTPUT_NAME})
add_dependencies(${TARGET_NAME} ${TARGET_NAME}_gch)