Skip to content

Commit

Permalink
Rename to MATIO_STATIC_LINK_MSVC_RT
Browse files Browse the repository at this point in the history
  • Loading branch information
tbeu committed Feb 10, 2024
1 parent e333695 commit 48fe47a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ jobs:
echo "/Users/runner/Library/Python/${{ matrix.python-version }}/bin" >> $GITHUB_PATH
fi
if [ "${{ matrix.compiler }}" == "msvc" ]; then
cmake -S . -B build -DMATIO_USE_CONAN=ON -DMATIO_SHARED=OFF
cmake -S . -B build -DMATIO_USE_CONAN=ON -DMATIO_SHARED=OFF -DMATIO_STATIC_LINK_MSVC_RT=ON --loglevel VERBOSE
elif [ "${{ matrix.compiler }}" == "mingw" ]; then
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DMATIO_USE_CONAN=ON -DMATIO_SHARED=OFF -G "MinGW Makefiles"
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DMATIO_USE_CONAN=ON -DMATIO_SHARED=OFF -G "MinGW Makefiles" --loglevel VERBOSE
else
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DMATIO_USE_CONAN=ON -DMATIO_SHARED=OFF
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DMATIO_USE_CONAN=ON -DMATIO_SHARED=OFF --loglevel VERBOSE
fi
- name: Build with ${{ matrix.compiler }}
run: |
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
pkg_add cmake
run: |
set -e
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DMATIO_SHARED=OFF -DMATIO_MAT73=OFF
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DMATIO_SHARED=OFF -DMATIO_MAT73=OFF --loglevel VERBOSE
cmake --build build -- -j8
./build/test_snprintf
./build/test_mat -H
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
run: |
set -e
mkdir build
cmake -S . -Bbuild -DCMAKE_BUILD_TYPE=Release -DMATIO_SHARED=OFF -DMATIO_MAT73=OFF
cmake -S . -Bbuild -DCMAKE_BUILD_TYPE=Release -DMATIO_SHARED=OFF -DMATIO_MAT73=OFF --loglevel VERBOSE
cmake --build build -- -j8
./build/test_snprintf
./build/test_mat -H
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Table of Contents
* 'MATIO_SHARED:BOOL=ON'
This option builds the matio library as shared object
(i.e., a dynamic link library on Windows).
* 'MATIO_STATIC_LINK_CRT:BOOL=OFF'
* 'MATIO_STATIC_LINK_MSVC_RT:BOOL=OFF'
This option links the MSVC runtime library statically.
* 'MATIO_WITH_HDF5:BOOL=ON'
This option enables CMake to check for availability of the
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ This flag enables the support for version 7.3 MAT files.
This option enables position-independent code (PIC), i.e., compilation with the `-fPIC` flag. It is ignored for Visual Studio builds.
* `MATIO_SHARED:BOOL=ON`
This option builds the matio library as shared object (i.e., a dynamic link library on Windows).
* `MATIO_STATIC_LINK_CRT:BOOL=OFF`
* `MATIO_STATIC_LINK_MSVC_RT:BOOL=OFF`
This option links the MSVC runtime library statically.
* `MATIO_WITH_HDF5:BOOL=ON`
This option enables CMake to check for availability of the HDF5 library (see section [2.1.2](#212-hdf5) for information about HDF5).
Expand Down
13 changes: 6 additions & 7 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@ option(MATIO_SHARED "Build shared matio library, disable for static library" ON)
# Option to enable position-independent code (PIC)
option(MATIO_PIC "Enable position-independent code (PIC), i.e., compilation with the -fPIC flag" ON)

# Option to link the MSVC runtime library statically
option(MATIO_STATIC_LINK_CRT "Link the MSVC runtime library statically" OFF)

if(POLICY CMP0091)
# CMake >= 3.15 has CMAKE_MSVC_RUNTIME_LIBRARY to set the MSVCC runtime library
if(WIN32 AND CMAKE_GENERATOR MATCHES "Visual Studio .*|NMake .*")
if(MATIO_STATIC_LINK_CRT)
message(STATUS "Configuring to link the MSVC runtime library statically")
if(MSVC)
# Option to link the MSVC runtime library statically
option(MATIO_STATIC_LINK_MSVC_RT "Link the MSVC runtime library statically" OFF)
if(MATIO_STATIC_LINK_MSVC_RT)
message(VERBOSE "Configuring to link the MSVC runtime library statically")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
else()
message(STATUS "Configuring to link the MSVC runtime library dynamically")
message(VERBOSE "Configuring to link the MSVC runtime library dynamically")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif()
endif()
Expand Down

0 comments on commit 48fe47a

Please sign in to comment.