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

update requiered cmake version #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 2.8.12)
PROJECT(conanpoco)
cmake_minimum_required(VERSION 3.1.2)
projecT(conanpoco CXX)
include(${CMAKE_CURRENT_SOURCE_DIR}/../conanbuildinfo.cmake)
CONAN_BASIC_SETUP()
conan_basic_setup(TARGETS)


macro(use_cxx11)
Expand All @@ -12,14 +12,14 @@ macro(use_cxx11)
else()
set(CMAKE_CXX_STANDARD 11)
endif()
endmacro(use_cxx11)
endmacro()

if(CXX_14)
MESSAGE("Activating CXX_STANDARD 14")
message("Activating CXX_STANDARD 14")
set(CMAKE_CXX_STANDARD 14)
else()
MESSAGE("Not activating CXX_STANDARD 14")
MESSAGE("Activating CXX_STANDARD 11")
message("Not activating CXX_STANDARD 14")
message("Activating CXX_STANDARD 11")
use_cxx11()
endif()

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ Complete the installation of requirements for your project running:

conan install .

Project setup installs the library (and all his dependencies) and generates the files *conanbuildinfo.txt* and *conanbuildinfo.cmake* with all the paths and variables that you need to link with your dependencies.
Project setup installs the library (and all his dependencies) and generates
the files *conanbuildinfo.txt* and *conanbuildinfo.cmake* with all the paths
and variables that you need to link with your dependencies.

23 changes: 13 additions & 10 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class PocoConan(ConanFile):
name = "Poco"
version = "1.9.0"
url = "http://github.com/pocoproject/conan-poco"
exports_sources = "CMakeLists.txt", "PocoMacros.cmake" # REMOVE POCOMACROS IN NEXT VERSION!
exports_sources = "CMakeLists.txt", "PocoMacros.cmake" # TODO: REMOVE POCOMACROS IN NEXT VERSION!
generators = "cmake", "txt"
settings = "os", "arch", "compiler", "build_type"
license = "The Boost Software License 1.0"
Expand Down Expand Up @@ -38,7 +38,7 @@ class PocoConan(ConanFile):
"enable_pagecompiler_file2page": [True, False],
"force_openssl": [True, False], # "Force usage of OpenSSL even under windows"
"enable_tests": [True, False],
#"enable_samples": [True, False],
# XXX "enable_samples": [True, False],
"poco_unbundled": [True, False],
"cxx_14": [True, False]
}
Expand Down Expand Up @@ -67,7 +67,7 @@ class PocoConan(ConanFile):
force_openssl=True
enable_tests=False
poco_unbundled=False
cxx_14=False
cxx_14=True
'''

def source(self):
Expand All @@ -84,14 +84,15 @@ def source(self):

def configure(self):
if self.options.enable_apacheconnector:
raise Exception("Apache connector not supported: https://github.com/pocoproject/poco/issues/1764")
raise Exception(
"Apache connector not supported: https://github.com/pocoproject/poco/issues/1764")

def requirements(self):
if self.options.enable_netssl or self.options.enable_netssl_win or self.options.enable_crypto or self.options.force_openssl:
self.requires.add("OpenSSL/1.0.2n@conan/stable", private=False)

if self.options.enable_data_mysql:
# self.requires.add("MySQLClient/6.1.6@hklabbers/stable")
# self.requires.add("MySQLClient/6.1.6@hklabbers/stable")
raise Exception("MySQL not supported yet, open an issue here please: %s" % self.url)

def build(self):
Expand All @@ -101,9 +102,10 @@ def build(self):
tools.replace_in_file("poco/NetSSL_Win/CMakeLists.txt", replace, replace + " ws2_32 ")

replace = 'Foundation ${OPENSSL_LIBRARIES}'
tools.replace_in_file("poco/Crypto/CMakeLists.txt", replace, replace + " ws2_32 Crypt32.lib")
tools.replace_in_file("poco/Crypto/CMakeLists.txt", replace,
replace + " ws2_32 Crypt32.lib")

cmake = CMake(self, parallel=None) # Parallel crashes building
cmake = CMake(self, parallel=None) # FIXME! Parallel crashes building
for option_name in self.options.values.fields:
activated = getattr(self.options, option_name)
if option_name == "shared":
Expand All @@ -112,7 +114,8 @@ def build(self):
cmake.definitions[option_name.upper()] = "ON" if activated else "OFF"

if self.settings.os == "Windows" and self.settings.compiler == "Visual Studio": # MT or MTd
cmake.definitions["POCO_MT"] = "ON" if "MT" in str(self.settings.compiler.runtime) else "OFF"
cmake.definitions["POCO_MT"] = "ON" if "MT" in str(
self.settings.compiler.runtime) else "OFF"
self.output.info(cmake.definitions)
os.mkdir("build")
cmake.configure(source_dir="../poco", build_dir="build")
Expand Down Expand Up @@ -163,8 +166,8 @@ def package_info(self):
("enable_json", "PocoJSON")]

suffix = str(self.settings.compiler.runtime).lower() \
if self.settings.compiler == "Visual Studio" and not self.options.shared \
else ("d" if self.settings.build_type=="Debug" else "")
if self.settings.compiler == "Visual Studio" and not self.options.shared \
else ("d" if self.settings.build_type == "Debug" else "")
for flag, lib in libs:
if getattr(self.options, flag):
if self.settings.os == "Windows" and flag == "enable_netssl":
Expand Down
37 changes: 12 additions & 25 deletions test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,19 @@
PROJECT(MyHello)
cmake_minimum_required(VERSION 3.0)

macro(use_cxx11)
if(CMAKE_VERSION VERSION_LESS "3.1")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set (CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}")
endif()
else()
set(CMAKE_CXX_STANDARD 11)
endif()
endmacro(use_cxx11)

use_cxx11()

cmake_minimum_required(VERSION 3.1.2)
project(MyHello CXX)
set(CMAKE_CXX_STANDARD 14)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
CONAN_BASIC_SETUP()

ADD_EXECUTABLE(echo EchoServer.cpp)
TARGET_LINK_LIBRARIES(echo ${CONAN_LIBS})
conan_basic_setup(TARGETS)

ADD_EXECUTABLE(socket socket.cpp)
TARGET_LINK_LIBRARIES(socket ${CONAN_LIBS})
add_executable(echo EchoServer.cpp)
conan_target_link_libraries(echo)

ADD_EXECUTABLE(md5 md5.cpp)
TARGET_LINK_LIBRARIES(md5 ${CONAN_LIBS})
add_executable(socket socket.cpp)
conan_target_link_libraries(socket)

ADD_EXECUTABLE(sample SampleApp.cpp)
TARGET_LINK_LIBRARIES(sample ${CONAN_LIBS})
add_executable(md5 md5.cpp)
conan_target_link_libraries(md5)

add_executable(sample SampleApp.cpp)
conan_target_link_libraries(sample)

1 change: 1 addition & 0 deletions test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class DefaultNameConan(ConanFile):
version = "0.1"
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
requires = "Poco/1.9.0@pocoproject/stable"

def build(self):
cmake = CMake(self)
Expand Down