From 9e79eb2a510e4013550b0633a1a99d9f1de201de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9verin=20Lemaignan?= Date: Sat, 12 Sep 2015 21:41:46 +0100 Subject: [PATCH] Prevent compilation (and installation) of shared lib when dlib included via dlib/cmake --- dlib/CMakeLists.txt | 6 +++--- dlib/cmake | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dlib/CMakeLists.txt b/dlib/CMakeLists.txt index cf534b55a..b295422c2 100644 --- a/dlib/CMakeLists.txt +++ b/dlib/CMakeLists.txt @@ -120,7 +120,7 @@ if (NOT TARGET dlib) if (DLIB_ISO_CPP_ONLY) add_library(dlib STATIC ${source_files} ) - if (RELEASE_MODE) + if (RELEASE_MODE AND NOT DLIB_IN_PROJECT_BUILD) add_library(dlib-shared SHARED ${source_files} ) endif() else() @@ -419,7 +419,7 @@ if (NOT TARGET dlib) add_library(dlib STATIC ${source_files} ) target_link_libraries(dlib ${dlib_needed_libraries} ) - if (RELEASE_MODE) + if (RELEASE_MODE AND NOT DLIB_IN_PROJECT_BUILD) add_library(dlib-shared SHARED ${source_files} ) target_link_libraries(dlib-shared ${dlib_needed_libraries} ) endif() @@ -427,7 +427,7 @@ if (NOT TARGET dlib) endif () ##### end of if NOT DLIB_ISO_CPP_ONLY ########################################################## # Install the library - if (RELEASE_MODE) + if (RELEASE_MODE AND NOT DLIB_IN_PROJECT_BUILD) set_target_properties(dlib-shared PROPERTIES OUTPUT_NAME dlib VERSION ${VERSION}) diff --git a/dlib/cmake b/dlib/cmake index d4a0bd2ed..969ea59a4 100644 --- a/dlib/cmake +++ b/dlib/cmake @@ -1,4 +1,7 @@ # This is a CMake file meant to be included via include() +# It will trigger a compilation of dlib *in the project* +# including it +set(DLIB_IN_PROJECT_BUILD true) cmake_minimum_required(VERSION 2.6.4)