From 80917dddc58007c3febca9ba102ffe8da4adf548 Mon Sep 17 00:00:00 2001 From: Emerson Knapp Date: Tue, 5 Mar 2019 02:14:06 +0000 Subject: [PATCH 1/3] Enable forcing the build, and pass through global C++ flags Signed-off-by: Emerson Knapp --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2697426..724d1be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,15 +3,20 @@ project(poco_vendor VERSION "1.1.1") # Can work with poco 1.4.1p1 (earliest to use recursive mutexes on Linux) # 1.6.1 is the first version to ship with PocoConfigVersion.cmake -find_package(Poco "1.6.1" COMPONENTS Foundation QUIET) +if(NOT FORCE_BUILD_POCO) + find_package(Poco "1.6.1" COMPONENTS Foundation QUIET) +endif() + if(NOT Poco_FOUND) + set(POCO_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + # If Poco was not found, download and build from source if(DEFINED CMAKE_BUILD_TYPE) list(APPEND extra_cmake_args -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}) endif() if(WIN32) - list(APPEND extra_cmake_args "-DCMAKE_CXX_FLAGS=/wd4244 /wd4530 /wd4577") + list(APPEND POCO_CXX_FLAGS "/wd4244 /wd4530 /wd4577") else() list(APPEND extra_cmake_args "-DCMAKE_C_FLAGS=-Wno-shift-negative-value") list(APPEND extra_cmake_args "-DCMAKE_CXX_STANDARD=14") @@ -46,6 +51,9 @@ if(NOT Poco_FOUND) endif() endif() endif() + list(APPEND extra_cmake_args "-DCMAKE_CXX_FLAGS=${POCO_CXX_FLAGS}") + list(APPEND extra_cmake_args "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}") + list(APPEND extra_cmake_args "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}") include(ExternalProject) ExternalProject_Add(poco-1.8.0.1-release From 60cf7196073a096d87cd8aec81087e34d14ee76d Mon Sep 17 00:00:00 2001 From: Emerson Knapp Date: Fri, 8 Mar 2019 20:36:55 +0000 Subject: [PATCH 2/3] Document FORCE_BUILD_POCO as a cmake option --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 724d1be..b7ce935 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,10 @@ cmake_minimum_required(VERSION 3.5) project(poco_vendor VERSION "1.1.1") +option(FORCE_BUILD_POCO + "Build Poco from source, even if system-installed package is available" + OFF) + # Can work with poco 1.4.1p1 (earliest to use recursive mutexes on Linux) # 1.6.1 is the first version to ship with PocoConfigVersion.cmake if(NOT FORCE_BUILD_POCO) From 088f2b88c234a96c5b9161be57583f7242cacfaa Mon Sep 17 00:00:00 2001 From: Emerson Knapp Date: Tue, 12 Mar 2019 21:12:10 +0000 Subject: [PATCH 3/3] Use global option FORCE_BUILD_VENDOR_PKG --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7ce935..132586f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,13 @@ cmake_minimum_required(VERSION 3.5) project(poco_vendor VERSION "1.1.1") -option(FORCE_BUILD_POCO +option(FORCE_BUILD_VENDOR_PKG "Build Poco from source, even if system-installed package is available" OFF) # Can work with poco 1.4.1p1 (earliest to use recursive mutexes on Linux) # 1.6.1 is the first version to ship with PocoConfigVersion.cmake -if(NOT FORCE_BUILD_POCO) +if(NOT FORCE_BUILD_VENDOR_PKG) find_package(Poco "1.6.1" COMPONENTS Foundation QUIET) endif()