[Build] Guard Linux-specific CMake config behind platform check
GTK3, system SDL2 (pkg-config), Linux link libraries, linker groups, and _GLIBCXX_DEBUG were in the generic non-MSVC branch, breaking cmake configure on non-Linux POSIX platforms.
This commit is contained in:
@@ -213,6 +213,7 @@ else()
|
|||||||
$<$<COMPILE_LANGUAGE:C>:-Wno-implicit-function-declaration>
|
$<$<COMPILE_LANGUAGE:C>:-Wno-implicit-function-declaration>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
# GTK3 via pkg-config
|
# GTK3 via pkg-config
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(GTK3 REQUIRED gtk+-x11-3.0)
|
pkg_check_modules(GTK3 REQUIRED gtk+-x11-3.0)
|
||||||
@@ -226,23 +227,28 @@ else()
|
|||||||
# Link groups for executables (resolves circular deps)
|
# Link groups for executables (resolves circular deps)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--start-group")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--start-group")
|
||||||
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,--end-group")
|
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -Wl,--end-group")
|
||||||
|
endif()
|
||||||
|
|
||||||
# --- Per-configuration Linux flags ---
|
# --- Per-configuration flags ---
|
||||||
# Checked
|
# Checked
|
||||||
string(APPEND CMAKE_C_FLAGS_CHECKED " -fsanitize=address")
|
string(APPEND CMAKE_C_FLAGS_CHECKED " -fsanitize=address")
|
||||||
string(APPEND CMAKE_CXX_FLAGS_CHECKED " -fsanitize=address")
|
string(APPEND CMAKE_CXX_FLAGS_CHECKED " -fsanitize=address")
|
||||||
string(APPEND CMAKE_EXE_LINKER_FLAGS_CHECKED " -fsanitize=address")
|
string(APPEND CMAKE_EXE_LINKER_FLAGS_CHECKED " -fsanitize=address")
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
$<$<CONFIG:Checked>:DEBUG>
|
$<$<CONFIG:Checked>:DEBUG>
|
||||||
$<$<CONFIG:Checked>:_GLIBCXX_DEBUG>
|
|
||||||
)
|
)
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
add_compile_definitions($<$<CONFIG:Checked>:_GLIBCXX_DEBUG>)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Debug
|
# Debug
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
$<$<CONFIG:Debug>:DEBUG>
|
$<$<CONFIG:Debug>:DEBUG>
|
||||||
$<$<CONFIG:Debug>:_NO_DEBUG_HEAP=1>
|
$<$<CONFIG:Debug>:_NO_DEBUG_HEAP=1>
|
||||||
$<$<CONFIG:Debug>:_GLIBCXX_DEBUG>
|
|
||||||
)
|
)
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
add_compile_definitions($<$<CONFIG:Debug>:_GLIBCXX_DEBUG>)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Release
|
# Release
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
|
|||||||
2
third_party/CMakeLists.txt
vendored
2
third_party/CMakeLists.txt
vendored
@@ -431,7 +431,7 @@ if(WIN32)
|
|||||||
)
|
)
|
||||||
target_include_directories(SDL2 PUBLIC SDL2/include)
|
target_include_directories(SDL2 PUBLIC SDL2/include)
|
||||||
target_link_libraries(SDL2 PRIVATE setupapi winmm imm32 version)
|
target_link_libraries(SDL2 PRIVATE setupapi winmm imm32 version)
|
||||||
else()
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
# Use system SDL2 on Linux
|
# Use system SDL2 on Linux
|
||||||
add_library(SDL2 INTERFACE)
|
add_library(SDL2 INTERFACE)
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
|
|||||||
Reference in New Issue
Block a user