Skip to content

Commit

Permalink
Workaround CMake Bugs (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
w4123 committed Apr 4, 2021
1 parent 8d7247a commit 825ff98
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "-fpermissive -Wno-invalid-source-encoding ${CMAKE_CXX_FLAGS}")
target_link_libraries(w4123.Dice PRIVATE $<$<VERSION_LESS:$<CXX_COMPILER_VERSION>,9.0>:c++fs>)
if(CMAKE_SYSTEM_NAME STREQUAL Android)
set(CMAKE_SHARED_LINKER_FLAGS "-static-libstdc++ ${CMAKE_SHARED_LINKER_FLAGS}")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
string(REGEX MATCH static IS_STATIC ${VCPKG_TARGET_TRIPLET})
if(IS_STATIC STREQUAL static)
Expand Down Expand Up @@ -60,6 +63,9 @@ check_ipo_supported(RESULT supported)

if(supported)
set_property(TARGET w4123.Dice PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
if(CMAKE_SYSTEM_NAME STREQUAL Android)
STRING(REGEX REPLACE "-fuse-ld=gold" "" CMAKE_CXX_LINK_OPTIONS_IPO ${CMAKE_CXX_LINK_OPTIONS_IPO})
endif()
endif()


Expand Down

0 comments on commit 825ff98

Please sign in to comment.