From 7dd2ecd026c2066e28d338ae6c1267580a120e0a Mon Sep 17 00:00:00 2001 From: Egor Pugin Date: Wed, 11 Apr 2018 00:16:31 +0300 Subject: [PATCH] Move cmake packages detection after compiler settings. --- CMakeLists.txt | 48 +++++++++++++++++++++++++++--------------------- cppan.yml | 2 ++ 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d6a87f95a8..7baf189d94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,27 +53,6 @@ set(GENERIC_MICRO_VERSION ${VERSION_PATCH}) set(MINIMUM_LEPTONICA_VERSION 1.74) -if(NOT EXISTS ${PROJECT_SOURCE_DIR}/.cppan) - if (NOT Leptonica_DIR AND NOT MSVC) - find_package(PkgConfig REQUIRED) - pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION}) - link_directories(${Leptonica_LIBRARY_DIRS}) - else() - find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED CONFIG) - endif() -else() - if (STATIC) - set(CPPAN_BUILD_SHARED_LIBS 0) - else() - set(CPPAN_BUILD_SHARED_LIBS 1) - endif() - add_subdirectory(.cppan) -endif() - -find_package(OpenCL QUIET) - -option(BUILD_TRAINING_TOOLS "Build training tools" ON) - ############################################################################### # # compiler and linker @@ -105,6 +84,33 @@ if (UNIX) set(LIB_pthread pthread) endif() +############################################################################### +# +# packages +# +############################################################################### + +if(NOT EXISTS ${PROJECT_SOURCE_DIR}/.cppan) + if (NOT Leptonica_DIR AND NOT MSVC) + find_package(PkgConfig REQUIRED) + pkg_check_modules(Leptonica REQUIRED lept>=${MINIMUM_LEPTONICA_VERSION}) + link_directories(${Leptonica_LIBRARY_DIRS}) + else() + find_package(Leptonica ${MINIMUM_LEPTONICA_VERSION} REQUIRED CONFIG) + endif() +else() + if (STATIC) + set(CPPAN_BUILD_SHARED_LIBS 0) + else() + set(CPPAN_BUILD_SHARED_LIBS 1) + endif() + add_subdirectory(.cppan) +endif() + +find_package(OpenCL QUIET) + +option(BUILD_TRAINING_TOOLS "Build training tools" ON) + ############################################################################### # # configure diff --git a/cppan.yml b/cppan.yml index a09dac91c9..57f718c641 100644 --- a/cppan.yml +++ b/cppan.yml @@ -1,5 +1,7 @@ local_settings: #use_shared_libs: true + #short_local_names: true + #use_cache: false #generator: Visual Studio 14 2015 Win64 silent: false #copy_import_libs: true