Skip to content

Commit

Permalink
build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nesbox committed Jun 1, 2024
1 parent 3e37e88 commit 1483632
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ endif()
if (BUILD_NO_OPTIMIZATION)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0")
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(LINKER_FLAGS_MINSIZEREL "-Wl,-dead_strip")
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} ${LINKER_FLAGS_MINSIZEREL}")
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL} ${LINKER_FLAGS_MINSIZEREL}")
endif()
elseif(NOT EMSCRIPTEN AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(LINKER_FLAGS_MINSIZEREL "-Wl,-dead_strip")
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} ${LINKER_FLAGS_MINSIZEREL}")
set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL} ${LINKER_FLAGS_MINSIZEREL}")
endif()

if (BUILD_ASAN_DEBUG)
Expand Down Expand Up @@ -100,17 +98,9 @@ if(MSVC)
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/lib )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin )

# use static runtime
# !TODO: use set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") from cmake 3.15 instead
if(CMAKE_C_FLAGS_${OUTPUTCONFIG} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" CMAKE_C_FLAGS_${OUTPUTCONFIG} "${CMAKE_C_FLAGS_${OUTPUTCONFIG}}")
endif()

if(CMAKE_CXX_FLAGS_${OUTPUTCONFIG} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_${OUTPUTCONFIG} "${CMAKE_CXX_FLAGS_${OUTPUTCONFIG}}")
endif()
endforeach()

set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
else()

set(CMAKE_C_STANDARD 11)
Expand Down

0 comments on commit 1483632

Please sign in to comment.