Skip to content

Commit e832e90

Browse files
committed
Fix: Switch to target_compile_options for robust generator expression expansion
1 parent 293fd5e commit e832e90

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ if (MSVC)
1313
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
1414
else()
1515
add_compile_options(-Wall -Wextra -Wno-sign-compare -Wno-unused-variable -Wno-unused-parameter)
16-
# Aggressive optimizations for GCC/Clang
17-
add_compile_options($<$<CONFIG:Release>:-O3;-march=native;-flto>)
18-
if(NOT APPLE)
19-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
20-
endif()
2116
endif()
2217

2318
# --- Build Configuration ---
@@ -217,6 +212,14 @@ if (LIBFFI_FOUND)
217212
target_link_libraries(prox_core PUBLIC ${LIBFFI_LIBRARIES})
218213
endif()
219214

215+
# Aggressive optimizations for GCC/Clang in Release mode
216+
if(NOT MSVC)
217+
target_compile_options(prox_core PRIVATE $<$<CONFIG:Release>:-O3 -march=native -flto>)
218+
if(NOT APPLE)
219+
target_link_options(prox_core PUBLIC $<$<CONFIG:Release>:-flto>)
220+
endif()
221+
endif()
222+
220223
# Main executable
221224
add_executable(proxpl src/main.c)
222225
target_link_libraries(proxpl PRIVATE prox_core)

0 commit comments

Comments
 (0)