Skip to content

Commit

Permalink
Replace std::shared_mutex with std::mutex on MinGW
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmy-park committed Mar 7, 2024
1 parent 69a9152 commit a821e5a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ else()
add_library(singleton-atomic INTERFACE)
endif()

# Modify source
if(MINGW)
file(READ ${CMAKE_SOURCE_DIR}/include/singleton_dclp.hpp DCLP)
string(REPLACE "#include <shared_mutex>\n" "" DCLP "${DCLP}")
string(REPLACE "std::shared_lock" "std::lock_guard" DCLP "${DCLP}")
string(REPLACE "std::shared_mutex" "std::mutex" DCLP "${DCLP}")
file(WRITE ${CMAKE_SOURCE_DIR}/include/singleton_dclp.hpp "${DCLP}")
endif()

# Create a singleton target
add_library(singleton::singleton ALIAS singleton)
target_compile_features(singleton ${SCOPE} cxx_std_11)
Expand Down

0 comments on commit a821e5a

Please sign in to comment.