From 5cabb7753cd1d27ec586d130e1a0bbf260e43c62 Mon Sep 17 00:00:00 2001 From: oltolm Date: Sat, 22 Apr 2023 12:17:59 +0200 Subject: [PATCH] cmake: modernize cmake code --- CMakeLists.txt | 17 +---------------- CMakePresets.json | 21 +++++++++++++++++++++ sample/CMakeLists.txt | 1 - src/addr2line/CMakeLists.txt | 2 -- src/catchsegv/CMakeLists.txt | 2 -- src/drmingw/CMakeLists.txt | 2 -- src/exchndl/CMakeLists.txt | 2 -- 7 files changed, 22 insertions(+), 25 deletions(-) create mode 100644 CMakePresets.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c63490..8aa0ea6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 \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 @@ -177,4 +162,4 @@ set (CPACK_GENERATOR "7Z") set (CPACK_STRIP_FILES ON) -include(CPack) +include(CPack) \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..9af21d1 --- /dev/null +++ b/CMakePresets.json @@ -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" + } + } + ] +} \ No newline at end of file diff --git a/sample/CMakeLists.txt b/sample/CMakeLists.txt index 471579c..de69013 100644 --- a/sample/CMakeLists.txt +++ b/sample/CMakeLists.txt @@ -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) diff --git a/src/addr2line/CMakeLists.txt b/src/addr2line/CMakeLists.txt index 0593521..d8b53b5 100644 --- a/src/addr2line/CMakeLists.txt +++ b/src/addr2line/CMakeLists.txt @@ -2,8 +2,6 @@ add_executable (addr2line addr2line.cpp ) -add_dependencies (addr2line mgwhelp_implib) - target_link_libraries (addr2line common mgwhelp_implib diff --git a/src/catchsegv/CMakeLists.txt b/src/catchsegv/CMakeLists.txt index 1f04c3d..cb1ba84 100644 --- a/src/catchsegv/CMakeLists.txt +++ b/src/catchsegv/CMakeLists.txt @@ -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 diff --git a/src/drmingw/CMakeLists.txt b/src/drmingw/CMakeLists.txt index 9c6f6f5..036a7e2 100644 --- a/src/drmingw/CMakeLists.txt +++ b/src/drmingw/CMakeLists.txt @@ -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 diff --git a/src/exchndl/CMakeLists.txt b/src/exchndl/CMakeLists.txt index a310e36..8ec2f3a 100644 --- a/src/exchndl/CMakeLists.txt +++ b/src/exchndl/CMakeLists.txt @@ -23,8 +23,6 @@ target_sources (exchndl PRIVATE version.rc ) -add_dependencies (exchndl mgwhelp_implib) - target_link_libraries (exchndl PRIVATE common mgwhelp_implib