Skip to content

Commit c79a389

Browse files
committed
cmake: Fix static SDL3 on Linux
1 parent 41600ea commit c79a389

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@ set(WIN_ICON ${CMAKE_CURRENT_SOURCE_DIR}/res/iris.rc)
88
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
99
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
1010
set(OSX_ICON ${CMAKE_CURRENT_SOURCE_DIR}/res/iris.icns)
11-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_STATIC=ON")
12-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSDL_STATIC=ON")
11+
1312
set_source_files_properties(${OSX_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
1413

1514
if (CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64")
1615
target_compile_options(iris PRIVATE -D_EE_USE_INTRINSICS)
1716
endif()
1817

18+
# Statically link SDL3 for Linux targets
19+
set(SDL_STATIC ON)
20+
21+
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
22+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
23+
endif()
24+
1925
# if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
2026
# add_custom_command(
2127
# OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/main_data.c"

0 commit comments

Comments
 (0)