diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f743e28cb0f..ecbad22fb15 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,24 +112,16 @@ jobs: with: arch: x64 - - name: Compile and Install GMT (Windows) + - name: Compile GMT (Windows) if: runner.os == 'Windows' shell: cmd run: | mkdir build cd build - setlocal enabledelayedexpansion - set "INSTALLDIR=%INSTALLDIR:\=/%" - set "WINVCPKGROOT=%VCPKG_INSTALLATION_ROOT:/=\%" - cmake -G Ninja .. -DCMAKE_TOOLCHAIN_FILE=!WINVCPKGROOT!\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release + cmake -G Ninja .. -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release cmake --build . - cmake --build . --target install - set "WININSTALLDIR=!INSTALLDIR:/=\!" - echo !WININSTALLDIR!\bin>> %GITHUB_PATH% - endlocal - - name: Install GMT (Linux/macOS) - if: runner.os != 'Windows' + - name: Install GMT run: | cd build cmake --build . --target install @@ -145,9 +137,7 @@ jobs: - name: Check a few simple commands shell: bash - run: | - export PATH="$INSTALLDIR/bin:$PATH" - bash ci/simple-gmt-tests.sh + run: bash ci/simple-gmt-tests.sh - name: Check a few simple commands (Windows) shell: cmd diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index afa3e7d46ed..4c80dfa91a4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -122,21 +122,14 @@ jobs: with: arch: x64 - - name: Compile and Install GMT (Windows) + - name: Compile GMT (Windows) if: runner.os == 'Windows' shell: cmd run: | mkdir build cd build - setlocal enabledelayedexpansion - set "INSTALLDIR=%INSTALLDIR:\=/%" - set "WINVCPKGROOT=%VCPKG_INSTALLATION_ROOT:/=\%" - cmake -G Ninja .. -DCMAKE_TOOLCHAIN_FILE=!WINVCPKGROOT!\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release + cmake -G Ninja .. -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release cmake --build . - cmake --build . --target install - set "WININSTALLDIR=!INSTALLDIR:/=\!" - echo !WININSTALLDIR!\bin>> %GITHUB_PATH% - endlocal - name: Build documentation run: | @@ -154,8 +147,7 @@ jobs: # See https://github.com/GenericMappingTools/gmt/issues/7253 grep -v 'WARNING: duplicate label -' doc/rst/html.log - - name: Install GMT (Linux/macOS) - if: runner.os != 'Windows' + - name: Install GMT run: | cd build cmake --build . --target install diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bae1aa07ab6..24e97fa821d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -118,21 +118,14 @@ jobs: with: arch: x64 - - name: Compile and Install GMT (Windows) + - name: Compile GMT (Windows) if: runner.os == 'Windows' shell: cmd run: | mkdir build cd build - setlocal enabledelayedexpansion - set "INSTALLDIR=%INSTALLDIR:\=/%" - set "WINVCPKGROOT=%VCPKG_INSTALLATION_ROOT:/=\%" - cmake -G Ninja .. -DCMAKE_TOOLCHAIN_FILE=!WINVCPKGROOT!\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release + cmake -G Ninja .. -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Release cmake --build . - cmake --build . --target install - set "WININSTALLDIR=!INSTALLDIR:/=\!" - echo !WININSTALLDIR!\bin>> %GITHUB_PATH% - endlocal - name: Pull baseline image data from dvc remote id: dvc-pull @@ -152,8 +145,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} - - name: Install GMT (Linux/macOS) - if: runner.os != 'Windows' + - name: Install GMT run: | cd build cmake --build . --target install diff --git a/cmake/modules/ConfigCMake.cmake b/cmake/modules/ConfigCMake.cmake index 460efc038e5..972ee264640 100644 --- a/cmake/modules/ConfigCMake.cmake +++ b/cmake/modules/ConfigCMake.cmake @@ -51,6 +51,11 @@ endif (EXISTS "${CMAKE_BINARY_DIR}/cmake/ConfigUserAdvanced.cmake") # Do any needed processing of the configuration variables # ########################################################### +# Normalize the installation prefix on Windows (avoid mixing slashes and backslashes). +if (WIN32) + file (TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_INSTALL_PREFIX) +endif (WIN32) + # Set default build type to 'Release' if (NOT CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE Release)