Squash project setup refactor
This commit is contained in:
committed by
Georg Hagen
parent
6a1a76f4d1
commit
071ced8cb0
33
cmake/functions/SetCompilerSettings.cmake
Normal file
33
cmake/functions/SetCompilerSettings.cmake
Normal file
@@ -0,0 +1,33 @@
|
||||
function(SetOptimisationSettings)
|
||||
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
|
||||
if (LINUX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native" PARENT_SCOPE)
|
||||
elseif (APPLE)
|
||||
add_compile_options("$<$<CONFIG:Release>:-O3>$<$<CONFIG:Debug>:-O0>$<$<CONFIG:MinSizeRel>:-Os>$<$<CONFIG:RelWithDebInfo>:-O2>")
|
||||
set(CMAKE_Swift_FLAGS_DEBUG "-Onone" PARENT_SCOPE)
|
||||
set(CMAKE_Swift_FLAGS_RELEASE "-O" PARENT_SCOPE)
|
||||
set(CMAKE_Swift_FLAGS_MINSIZEREL "-Osize" PARENT_SCOPE)
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
function(SetWarningSettings TARGET)
|
||||
if (LINUX)
|
||||
target_compile_options(${TARGET} PRIVATE -Wall -Wno-unknown-pragmas)
|
||||
elseif (WIN32)
|
||||
if (MSVC)
|
||||
set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS "/wd4068")
|
||||
set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "/ignore:4099")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(SetOutputDirs BASE_DIR)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${BASE_DIR}" PARENT_SCOPE)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${BASE_DIR}/release" PARENT_SCOPE)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${BASE_DIR}/minsizerel" PARENT_SCOPE)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${BASE_DIR}/relwithdebinfo" PARENT_SCOPE)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${BASE_DIR}/debug" PARENT_SCOPE)
|
||||
set(CMAKE_DEBUG_POSTFIX "d" PARENT_SCOPE)
|
||||
endfunction()
|
||||
Reference in New Issue
Block a user