From ab5e10929889963c8ffaaa1654621aa7f381b51c Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Thu, 11 Nov 2021 21:56:25 +0100 Subject: [PATCH 1/3] Revert "cmake: fix incorrect relative path concatenation (#733)" This reverts commit 68964b8db6952aee33c1ece7d3215da531c92991. --- AUTHORS | 1 - CMakeLists.txt | 2 +- CONTRIBUTORS | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/AUTHORS b/AUTHORS index 5f74a7a..5d8cc0d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -19,7 +19,6 @@ Guillaume Dumont Marco Wang Michael Tanner MiniLight -Niklas Hambuechen romange Roman Perepelitsa Sergiu Deitsch diff --git a/CMakeLists.txt b/CMakeLists.txt index 990daa4..ca93d0b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1027,7 +1027,7 @@ configure_file (\"${CMAKE_CURRENT_SOURCE_DIR}/glog-modules.cmake.in\" file (INSTALL \"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/glog-modules.cmake\" DESTINATION - \"${_glog_CMake_INSTALLDIR}\") + \"\${CMAKE_INSTALL_PREFIX}/${_glog_CMake_INSTALLDIR}\") " COMPONENT Development ) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index b125035..571fd96 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -39,7 +39,6 @@ Marco Wang Michael Darr Michael Tanner MiniLight -Niklas Hambuechen Peter Collingbourne Rodrigo Queiro romange From 4df5ae7463be874d9088526fa8c75724b24c2cc3 Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Thu, 11 Nov 2021 22:02:52 +0100 Subject: [PATCH 2/3] ci: added cmake package config test --- .github/workflows/linux-builds.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux-builds.yml b/.github/workflows/linux-builds.yml index be567cf..801239a 100644 --- a/.github/workflows/linux-builds.yml +++ b/.github/workflows/linux-builds.yml @@ -50,12 +50,32 @@ jobs: -DBUILD_SHARED_LIBS=${{matrix.shared}} \ -DCMAKE_CXX_STANDARD=${{matrix.std}} \ -DCMAKE_CXX_STANDARD_REQUIRED=ON \ - -DCMAKE_PREFIX_PATH=./install \ + -DCMAKE_INSTALL_PREFIX:PATH=./install \ -DWITH_CUSTOM_PREFIX=${{matrix.custom_prefix}} + - name: Build run: | cmake --build build_${{matrix.build_type}} \ --config ${{matrix.build_type}} + + - name: Install + run: | + cmake --build build_${{matrix.build_type}} \ + --config ${{matrix.build_type}} \ + --target install + + - name: Test CMake Package + run: | + if [[ ${{matrix.build_type}} == "Debug" ]]; then + export CXXFLAGS=--coverage + fi + cmake -S src/package_config_unittest/working_config \ + -B build_${{matrix.build_type}}_package \ + -DCMAKE_PREFIX_PATH=./build_${{matrix.build_type}}/install \ + -G Ninja + cmake --build build_${{matrix.build_type}}_package \ + --config ${{matrix.build_type}} + - name: Test run: | ctest --test-dir build_${{matrix.build_type}} -j$(nproc) --output-on-failure From 64b4e327ff6bcc5a10a7e54949cde72cdf2baa7d Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Thu, 11 Nov 2021 22:22:51 +0100 Subject: [PATCH 3/3] cmake: fixed glog-modules.cmake installation --- .github/workflows/linux-builds.yml | 32 +++++++++++++++++++++++------- CMakeLists.txt | 8 +++++++- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/.github/workflows/linux-builds.yml b/.github/workflows/linux-builds.yml index 801239a..c4c22d2 100644 --- a/.github/workflows/linux-builds.yml +++ b/.github/workflows/linux-builds.yml @@ -41,11 +41,13 @@ jobs: -G Ninja cmake --build build-googletest --target install + - name: Setup Environment + if: ${{matrix.build_type == 'Debug'}} + run: | + echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV + - name: Configure run: | - if [[ ${{matrix.build_type}} == "Debug" ]]; then - export CXXFLAGS=--coverage - fi cmake -S . -B build_${{matrix.build_type}} -G Ninja \ -DBUILD_SHARED_LIBS=${{matrix.shared}} \ -DCMAKE_CXX_STANDARD=${{matrix.std}} \ @@ -64,18 +66,34 @@ jobs: --config ${{matrix.build_type}} \ --target install - - name: Test CMake Package + cmake build_${{matrix.build_type}} -G Ninja \ + -DCMAKE_INSTALL_INCLUDEDIR=${{runner.workspace}}/foo/include \ + -DCMAKE_INSTALL_LIBDIR=${{runner.workspace}}/foo/lib \ + -DCMAKE_INSTALL_DATAROOTDIR=${{runner.workspace}}/foo/share + cmake --build build_${{matrix.build_type}} \ + --config ${{matrix.build_type}} \ + --target install + + - name: Test CMake Package (relative GNUInstallDirs) run: | - if [[ ${{matrix.build_type}} == "Debug" ]]; then - export CXXFLAGS=--coverage - fi cmake -S src/package_config_unittest/working_config \ -B build_${{matrix.build_type}}_package \ + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ -DCMAKE_PREFIX_PATH=./build_${{matrix.build_type}}/install \ -G Ninja cmake --build build_${{matrix.build_type}}_package \ --config ${{matrix.build_type}} + - name: Test CMake Package (absolute GNUInstallDirs) + run: | + cmake -S src/package_config_unittest/working_config \ + -B build_${{matrix.build_type}}_package_foo \ + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ + -DCMAKE_PREFIX_PATH=${{runner.workspace}}/foo \ + -G Ninja + cmake --build build_${{matrix.build_type}}_package_foo \ + --config ${{matrix.build_type}} + - name: Test run: | ctest --test-dir build_${{matrix.build_type}} -j$(nproc) --output-on-failure diff --git a/CMakeLists.txt b/CMakeLists.txt index ca93d0b..bcf04c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1022,12 +1022,18 @@ configure_file (glog-modules.cmake.in install (CODE " set (glog_FULL_CMake_DATADIR \"\\\${CMAKE_CURRENT_LIST_DIR}/${glog_REL_CMake_DATADIR}\") +set (glog_DATADIR_DESTINATION ${_glog_CMake_INSTALLDIR}) + +if (NOT IS_ABSOLUTE ${_glog_CMake_INSTALLDIR}) + set (glog_DATADIR_DESTINATION \"\${CMAKE_INSTALL_PREFIX}/\${glog_DATADIR_DESTINATION}\") +endif (NOT IS_ABSOLUTE ${_glog_CMake_INSTALLDIR}) + configure_file (\"${CMAKE_CURRENT_SOURCE_DIR}/glog-modules.cmake.in\" \"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/glog-modules.cmake\" @ONLY) file (INSTALL \"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/glog-modules.cmake\" DESTINATION - \"\${CMAKE_INSTALL_PREFIX}/${_glog_CMake_INSTALLDIR}\") + \"\${glog_DATADIR_DESTINATION}\") " COMPONENT Development )