diff --git a/conanfile.txt b/conanfile.txt new file mode 100644 index 0000000..af7cfb0 --- /dev/null +++ b/conanfile.txt @@ -0,0 +1,6 @@ +[requires] +cunit/2.1-3@atolab/stable +criterion/2.3.2@atolab/stable + +[generators] +cmake diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6935ba3..fc71e25 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -51,6 +51,32 @@ if(${CMAKE_C_COMPILER_ID} STREQUAL "SunPro") set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -m64") 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(GNUInstallDirs) include(AnalyzeBuild)