add support for Conan managed dependencies

Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
This commit is contained in:
Jeroen Koekkoek 2018-08-05 22:20:42 +02:00
parent 169b4129f0
commit 44ea435506
2 changed files with 32 additions and 0 deletions

6
conanfile.txt Normal file
View file

@ -0,0 +1,6 @@
[requires]
cunit/2.1-3@atolab/stable
criterion/2.3.2@atolab/stable
[generators]
cmake

View file

@ -51,6 +51,32 @@ if(${CMAKE_C_COMPILER_ID} STREQUAL "SunPro")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -m64") set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -m64")
endif() endif()
# Conan
if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
if(APPLE)
# By default Conan strips all RPATHs (see conanbuildinfo.cmake), which
# causes tests to fail as the executables cannot find the library target.
# By setting KEEP_RPATHS, Conan does not set CMAKE_SKIP_RPATH and the
# resulting binaries still have the RPATH information. This is fine because
# CMake will strip the build RPATH information in the install step.
#
# NOTE:
# Conan's default approach is to use the "imports" feature, which copies
# all the dependencies into the bin directory. Of course, this doesn't work
# quite that well for libraries generated in this Project (see Conan
# documentation).
#
# See the links below for more information.
# https://github.com/conan-io/conan/issues/337
# https://docs.conan.io/en/latest/howtos/manage_shared_libraries/rpaths.html
# https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling
conan_basic_setup(KEEP_RPATHS)
else()
conan_basic_setup()
endif()
endif()
include(FileIDs) include(FileIDs)
include(GNUInstallDirs) include(GNUInstallDirs)
include(AnalyzeBuild) include(AnalyzeBuild)