From d8668e3ed8dd8627655bcd6782154ae900df773c Mon Sep 17 00:00:00 2001 From: Snaipe Date: Thu, 3 Sep 2015 18:20:17 +0200 Subject: [PATCH] Added cmake dyncall dependency search --- .cmake/Modules/FindDyncall.cmake | 31 +++++++++++++++++++++++++++++++ CMakeLists.txt | 7 +++++-- appveyor.yml | 3 ++- 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 .cmake/Modules/FindDyncall.cmake diff --git a/.cmake/Modules/FindDyncall.cmake b/.cmake/Modules/FindDyncall.cmake new file mode 100644 index 0000000..83070f6 --- /dev/null +++ b/.cmake/Modules/FindDyncall.cmake @@ -0,0 +1,31 @@ +# Copyright (C) 2015 Franklin "Snaipe" Mathieu. +# Redistribution and use of this file is allowed according to the terms of the MIT license. +# For details see the LICENSE file distributed with Criterion. + +# - Find dyncall +# Find the native libcsptr headers and libraries. +# +# DYNCALL_INCLUDE_DIRS - where to find smart_ptr.h, etc. +# DYNCALL_LIBRARIES - List of libraries when using libcsptr. +# DYNCALL_FOUND - True if libcsptr has been found. + +# Look for the header file. +FIND_PATH(DYNCALL_INCLUDE_DIR dyncall.h) + +# Look for the library. +FIND_LIBRARY(DYNCALL_LIBRARY NAMES dyncall_s) + +# Handle the QUIETLY and REQUIRED arguments and set DYNCALL_FOUND to TRUE if all listed variables are TRUE. +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(DYNCALL DEFAULT_MSG DYNCALL_LIBRARY DYNCALL_INCLUDE_DIR) + +# Copy the results to the output variables. +IF(DYNCALL_FOUND) + SET(DYNCALL_LIBRARIES ${DYNCALL_LIBRARY}) + SET(DYNCALL_INCLUDE_DIRS ${DYNCALL_INCLUDE_DIR}) +ELSE(DYNCALL_FOUND) + SET(DYNCALL_LIBRARIES) + SET(DYNCALL_INCLUDE_DIRS) +ENDIF(DYNCALL_FOUND) + +MARK_AS_ADVANCED(DYNCALL_INCLUDE_DIRS DYNCALL_LIBRARIES) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba5c894..49630d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,7 @@ CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME) find_package(PCRE) find_package(Libcsptr REQUIRED) +find_package(Dyncall REQUIRED) # List sources and headers @@ -118,12 +119,14 @@ if (LIBINTL_LIB_FOUND) target_link_libraries(criterion ${LIBINTL_LIBRARIES}) endif() +if (DYNCALL_FOUND) + target_link_libraries(criterion ${DYNCALL_LIBRARIES}) +endif() + if (COVERALLS) coveralls_setup("${SOURCE_FILES}" ${COVERALLS_UPLOAD}) endif() -target_link_libraries(criterion dyncall_s) - install(FILES ${INTERFACE_FILES} DESTINATION include/criterion) install(TARGETS criterion RUNTIME DESTINATION bin diff --git a/appveyor.yml b/appveyor.yml index ee761a2..ca54394 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,10 +28,11 @@ install: # Hack to make git think it is on the tip of the repo branch - 'git checkout -B %APPVEYOR_REPO_BRANCH%' # Install dependencies - - 'bash -lc "cd $APPVEYOR_BUILD_FOLDER; .ci/install-dyncall.sh; true"' + - 'bash -lc "cd $APPVEYOR_BUILD_FOLDER; exec 0