Refactor CMakeLists

Closes #2471
Closes #1816
This commit is contained in:
Mohammad Nejati
2024-11-20 19:54:25 +00:00
committed by Mohammad Nejati
parent a21250d12d
commit 75e45287fb
82 changed files with 916 additions and 1359 deletions

View File

@@ -0,0 +1,5 @@
# Include gcc options.
include(${CMAKE_CURRENT_LIST_DIR}/gcc.cmake)
# Compiler options.
add_compile_options(-Wrange-loop-analysis)

View File

@@ -0,0 +1,18 @@
# C++ standard.
set(CMAKE_CXX_EXTENSIONS OFF CACHE STRING "")
# Static library linkage.
set(BUILD_SHARED_LIBS OFF CACHE STRING "")
add_definitions(-DBOOST_ALL_STATIC_LINK=1)
# Interprocedural optimization.
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON CACHE STRING "")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL ON CACHE STRING "")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO ON CACHE STRING "")
# Compiler definitions.
if(WIN32)
add_definitions(-D_WIN32_WINNT=0x0601 -D_CRT_SECURE_NO_WARNINGS)
endif()
# Project options.

View File

@@ -0,0 +1,5 @@
# Include common options.
include(${CMAKE_CURRENT_LIST_DIR}/common.cmake)
# Compiler options.
add_compile_options(-Wall -Wextra -Wpedantic -Wno-unused-parameter)

View File

@@ -0,0 +1,35 @@
# Include common options.
include(${CMAKE_CURRENT_LIST_DIR}/common.cmake)
# Static runtime linkage.
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" CACHE STRING "")
# Compiler options.
# Specific to C and CXX, to prevent passing them to MASM
add_compile_options(
$<$<COMPILE_LANGUAGE:CXX>:/bigobj>
$<$<COMPILE_LANGUAGE:CXX>:/permissive->
$<$<COMPILE_LANGUAGE:C,CXX>:/W4>
$<$<COMPILE_LANGUAGE:C,CXX>:/MP>
)
if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "Win32") # 32-bit
add_compile_options(
/arch:SSE2
)
endif()
# Linker options.
add_link_options(
)
# Disable logos.
foreach(lang C CXX ASM_MASM RC)
set(CMAKE_${lang}_FLAGS_INIT "/nologo")
endforeach()
foreach(type EXE SHARED MODULE)
set(CMAKE_${type}_LINKER_FLAGS_INIT "/nologo")
endforeach()
# Silence Visual Studio CMake integration warnings.
set(SILENCE_VS_DEFINITIONS ${CMAKE_TOOLCHAIN_FILE} ${CMAKE_C_COMPILER})
set(SILENCE_VS_DEFINITIONS)