Skip to content

Commit

Permalink
cmake: modernize cmake code
Browse files Browse the repository at this point in the history
  • Loading branch information
oltolm committed Apr 24, 2023
1 parent 4a7e249 commit 5cabb77
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 25 deletions.
17 changes: 1 addition & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,6 @@ add_compile_options (-fno-strict-aliasing)

include (StaticCRT)

# Avoid Posix threads. Posix threads is required for support of certain C++11
# multi-threading features, but it introduces a new DLL dependency and we don't
# use those features.
# https://github.com/jrfonseca/drmingw/issues/82#issuecomment-1360081041
execute_process (
COMMAND "${CMAKE_COMMAND}" -E echo "#include <thread>\n#ifdef _GLIBCXX_HAS_GTHREADS\n#error _GLIBCXX_HAS_GTHREADS\n#endif"
COMMAND "${CMAKE_CXX_COMPILER}" -x c++ -E -
RESULT_VARIABLE STATUS_CXX11_THREADS
OUTPUT_QUIET
ERROR_QUIET
)
if (NOT STATUS_CXX11_THREADS EQUAL 0)
message (SEND_ERROR "Win32 threads required.")
endif ()

# Enable stack protection
# XXX: Broken on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86832
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0" OR
Expand Down Expand Up @@ -177,4 +162,4 @@ set (CPACK_GENERATOR "7Z")

set (CPACK_STRIP_FILES ON)

include(CPack)
include(CPack)
21 changes: 21 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": 3,
"configurePresets": [
{
"name": "gcc64",
"generator": "Ninja",
"binaryDir": "build-gcc64",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "gcc32",
"generator": "Ninja",
"binaryDir": "build-gcc32",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
}
]
}
1 change: 0 additions & 1 deletion sample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ force_debug ()
add_executable (sample
sample.cpp
)
add_dependencies (sample exchndl_implib)
target_link_libraries (sample PRIVATE exchndl_implib)

install (FILES sample.cpp DESTINATION sample)
Expand Down
2 changes: 0 additions & 2 deletions src/addr2line/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ add_executable (addr2line
addr2line.cpp
)

add_dependencies (addr2line mgwhelp_implib)

target_link_libraries (addr2line
common
mgwhelp_implib
Expand Down
2 changes: 0 additions & 2 deletions src/catchsegv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ include_directories (

set_property (TARGET catchsegv APPEND_STRING PROPERTY LINK_FLAGS " -municode")

add_dependencies (catchsegv mgwhelp_implib)

target_link_libraries (catchsegv
common
getoptW
Expand Down
2 changes: 0 additions & 2 deletions src/drmingw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ target_compile_definitions (drmingw PRIVATE
VERSION="${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}"
)

add_dependencies (drmingw mgwhelp_implib)

target_link_libraries (drmingw
common
mgwhelp_implib
Expand Down
2 changes: 0 additions & 2 deletions src/exchndl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ target_sources (exchndl PRIVATE
version.rc
)

add_dependencies (exchndl mgwhelp_implib)

target_link_libraries (exchndl PRIVATE
common
mgwhelp_implib
Expand Down

0 comments on commit 5cabb77

Please sign in to comment.