From ebe7035298f6fcac631d70988412cdf0e5c492d6 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Thu, 2 Aug 2018 13:43:54 +0200 Subject: [PATCH] find xlnt without pkgconfig --- cmake/FindXLNT.cmake | 30 ++++++++++++++++++++++++++++++ src/core/CMakeLists.txt | 5 +++-- 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 cmake/FindXLNT.cmake diff --git a/cmake/FindXLNT.cmake b/cmake/FindXLNT.cmake new file mode 100644 index 0000000..8bced8e --- /dev/null +++ b/cmake/FindXLNT.cmake @@ -0,0 +1,30 @@ +#ckwg +4 +# Copyright 2010 by Kitware, Inc. All Rights Reserved. Please refer to +# KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, +# Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. + +# Locate the system installed XLNT +# The following variables will be set: +# +# XLNT_FOUND - Set to true if XLNT can be found +# XLNT_INCLUDE_DIR - The path to the XLNT header files +# XLNT_LIBRARY - The full path to the XLNT library + +if( XLNT_DIR ) + if( XLNT_FIND_VERSION ) + find_package( XLNT ${XLNT_FIND_VERSION} NO_MODULE) + else() + find_package( XLNT NO_MODULE) + endif() +elseif( NOT XLNT_FOUND ) + message(STATUS "Searching for xlnt.hpp") + find_path( XLNT_INCLUDE_DIR xlnt ) + message(STATUS "Searching for xlnt.hpp - ${XLNT_INCLUDE_DIR}") + + message(STATUS "Searching for libXLNT") + find_library( XLNT_LIBRARY xlnt ) + message(STATUS "Searching for libXLNT - ${XLNT_LIBRARY}") + + include( FindPackageHandleStandardArgs ) + FIND_PACKAGE_HANDLE_STANDARD_ARGS( XLNT XLNT_INCLUDE_DIR XLNT_LIBRARY ) +endif() diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index d699085..8708072 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -3,7 +3,8 @@ set(Boost_USE_STATIC_LIBS ON) find_package(Boost 1.62 COMPONENTS date_time REQUIRED) find_package(SQLite3 REQUIRED) find_package(PkgConfig REQUIRED) -pkg_check_modules(XLNT REQUIRED xlnt>=1.3) +find_package(XLNT REQUIRED) +#pkg_check_modules(XLNT REQUIRED xlnt>=1.3) pkg_check_modules(JSONCPP REQUIRED jsoncpp) set(CORE_SOURCES @@ -19,7 +20,7 @@ set(CORE_SOURCES ) add_library(core STATIC ${CORE_SOURCES}) -target_link_libraries(core Boost::boost Boost::date_time sqlite3 ${XLNT_LIBRARIES} ${JSONCPP_LIBRARIES}) +target_link_libraries(core Boost::boost Boost::date_time sqlite3 ${XLNT_LIBRARY} ${JSONCPP_LIBRARIES}) if (WIN32) target_link_libraries(core bcrypt) endif()