From 59a80eba2e711d1279e5e6aaac91b571976adf37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 16 May 2021 20:40:55 +0200 Subject: [PATCH] mac - cmake_paths does not work directly on mac --- .github/workflows/on_PR_mac_matrix.yml | 3 ++- .github/workflows/on_push_BasicWinLinMac.yml | 2 ++ cmake/findDependencies.cmake | 13 +++++++++++-- conanfile.py | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/on_PR_mac_matrix.yml b/.github/workflows/on_PR_mac_matrix.yml index b290de03..01d3070b 100644 --- a/.github/workflows/on_PR_mac_matrix.yml +++ b/.github/workflows/on_PR_mac_matrix.yml @@ -27,6 +27,8 @@ jobs: conan profile new --detect default conan profile show default conan install .. -o webready=True --build missing + # Hack: Delete cmake_find_package generated files to fix compilation on mac. + rm Find* - name: Build run: | @@ -38,7 +40,6 @@ jobs: run: | cd build cmake --build . --target install - # tree install Not available on Mac - name: Test env: diff --git a/.github/workflows/on_push_BasicWinLinMac.yml b/.github/workflows/on_push_BasicWinLinMac.yml index cb9f5b39..720cf010 100644 --- a/.github/workflows/on_push_BasicWinLinMac.yml +++ b/.github/workflows/on_push_BasicWinLinMac.yml @@ -103,6 +103,8 @@ jobs: conan profile new --detect default conan profile show default conan install .. -o webready=True --build missing + # Hack: Delete cmake_find_package generated files to fix compilation on mac. + rm Find* - name: build and compile run: | diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake index 16d1cfc0..94235c94 100644 --- a/cmake/findDependencies.cmake +++ b/cmake/findDependencies.cmake @@ -1,6 +1,15 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") -list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) -list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) + +if (APPLE) + # On Apple, we use the conan cmake_paths generator + if (EXISTS ${CMAKE_BINARY_DIR}/conan_paths.cmake) + include(${CMAKE_BINARY_DIR}/conan_paths.cmake) + endif() +else() + # Otherwise, we rely on the conan cmake_find_package generator + list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}) + list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}) +endif() find_package (Python3 COMPONENTS Interpreter REQUIRED) diff --git a/conanfile.py b/conanfile.py index b496b510..23de4359 100644 --- a/conanfile.py +++ b/conanfile.py @@ -4,7 +4,7 @@ from conans.model.version import Version class Exiv2Conan(ConanFile): settings = 'os', 'compiler', 'build_type', 'arch' - generators = 'cmake_find_package' + generators = 'cmake_find_package', 'cmake_paths' options = {'unitTests': [True, False], 'xmp': [True, False], 'iconv': [True, False],