SoftwareNetwork / sw

Software Manager. Build System, Build System Generator and Package Manager. C/C++ and other languages. Tools and libraries for Software Management.
https://software-network.org
Other
115 stars 23 forks source link

improve "-mt" flag detection in cmake config #107

Closed dmorgoon closed 1 year ago

dmorgoon commented 1 year ago

Take CMAKE_MSVC_RUNTIME_LIBRARY variable into account if it is used by user`s cmake config.

Starting form CMake version 3.15 there is a new variable available for setting MSVC ABI: CMAKE_MSVC_RUNTIME_LIBRARY. According to documentation it has effect only when policy CMP0091 is set to NEW.

egorpugin commented 1 year ago

Hi,

Thank you for the patch.

Could you fix line endings to LF? See https://github.com/SoftwareNetwork/sw/pull/107/files?w=0

dmorgoon commented 1 year ago

Hi,

Thank you for the patch.

Could you fix line endings to LF? See https://github.com/SoftwareNetwork/sw/pull/107/files?w=0

@egorpugin sorry, my fault. Will fix it

dmorgoon commented 1 year ago

@egorpugin Also i'm not quite shure how to properly write tests for this case, that will satisfy wrokflow for your project. I could give you some basic cmake project example, that explore this feature and fails to build with current version of SWConfig.cmake.

egorpugin commented 1 year ago

We do not need tests for it at the moment.

dmorgoon commented 1 year ago

I've checked SWConfig.cmake in my repo and it seems already having LF line endings. You can examine it by downloading zip archive: https://github.com/dmorgoon/sw/archive/refs/heads/fix-cmake-mt.zip. However, if you download archive from your repo, it seems like it has mixed line endings. For example, it has <LF> at the end of line 1, but <CRLF> after line 8 and line 9. Please, correct me if i'm wrong

dmorgoon commented 1 year ago

Here is partial output of git diff HEAD~1 -R src/sw/client/common/inserts/SWConfig.cmake from checked out fix-cmake-variant (-R switch in command to reverse the direction of comparrision):

diff --git b/src/sw/client/common/inserts/SWConfig.cmake a/src/sw/client/common/inserts/SWConfig.cmake
index 6db4b2fd..59b32ce5 100644
--- b/src/sw/client/common/inserts/SWConfig.cmake
+++ a/src/sw/client/common/inserts/SWConfig.cmake
@@ -5,165 +5,147 @@
 #
 # SWConfig.cmake
 #
-################################################################################
-
+################################################################################^M
+^M
 # increase this variable when file is changed
 # and you need user to call 'sw setup' again to update this file
-set(SW_CMAKE_VERSION 7)
-
+set(SW_CMAKE_VERSION 6)
+^M
 ########################################
-# general settings
+# general settings^M
 ########################################
-
-find_program(SW_EXECUTABLE sw)
-
-# some standard cmake handling of vars
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(SW DEFAULT_MSG SW_EXECUTABLE)
-mark_as_advanced(SW_EXECUTABLE)
-
-set(SW_DEPS_DIR "${CMAKE_BINARY_DIR}/.sw/cmake" CACHE STRING "SW local deps dir.")
+^M
+find_program(SW_EXECUTABLE sw)^M
+
+# some standard cmake handling of vars^M
+include(FindPackageHandleStandardArgs)^M
+find_package_handle_standard_args(SW DEFAULT_MSG SW_EXECUTABLE)^M
egorpugin commented 1 year ago

I see. Thank you.