diff --git a/CMakeLists.txt b/CMakeLists.txt index 905c80a..03c7ed5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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() diff --git a/README.md b/README.md index c20cf72..79fb51f 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/conanfile.py b/conanfile.py index 213965e..2e9dfcf 100644 --- a/conanfile.py +++ b/conanfile.py @@ -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" @@ -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] } @@ -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): @@ -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): @@ -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": @@ -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") @@ -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": diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt index c7dbd3b..2c0c392 100644 --- a/test_package/CMakeLists.txt +++ b/test_package/CMakeLists.txt @@ -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) diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 7c76ac0..e40c9fa 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -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)