Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
Enable forcing build from source, and pass through c++ flags (#24)
Browse files Browse the repository at this point in the history
* Enable forcing the build, and pass through global C++ flags

Signed-off-by: Emerson Knapp <eknapp@amazon.com>
  • Loading branch information
emersonknapp authored and nuclearsandwich committed Mar 21, 2019
1 parent 555ba41 commit db38063
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
cmake_minimum_required(VERSION 3.5)
project(poco_vendor VERSION "1.1.1")

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
find_package(Poco "1.6.1" COMPONENTS Foundation QUIET)
if(NOT FORCE_BUILD_VENDOR_PKG)
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")
Expand Down Expand Up @@ -46,6 +55,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
Expand Down

0 comments on commit db38063

Please sign in to comment.