diff --git a/conanfile.py b/conanfile.py index 6c62225d..63dda29e 100644 --- a/conanfile.py +++ b/conanfile.py @@ -28,7 +28,7 @@ def set_version(self): "with_zlib": [True, False], } default_options = { - "shared": True, + "shared": False, "fPIC": True, "with_zlib": True, } @@ -65,11 +65,13 @@ def build(self): source_folder=self.source_folder.replace("\\", "/"), install_folder=self.install_folder.replace("\\", "/"))) cmake = CMake(self) + cmake.definitions["SEASOCKS_SHARED"] = self.options.shared cmake.definitions["DEFLATE_SUPPORT"] = self.options.with_zlib cmake.configure(source_folder=self.build_folder) cmake.build() def package(self): + self.copy("LICENSE", dst="licenses") cmake = CMake(self) cmake.install() @@ -78,6 +80,8 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "Seasocks" self.cpp_info.names["cmake_find_package_multi"] = "Seasocks" self.cpp_info.components["libseasocks"].libs = ["seasocks"] + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.components["libseasocks"].system_libs = ["pthread"] # Set the name of the generated seasocks target: `Seasocks::seasocks` self.cpp_info.components["libseasocks"].names["cmake_find_package"] = "seasocks" self.cpp_info.components["libseasocks"].names["cmake_find_package_multi"] = "seasocks" diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt index 0e7869d9..2dc844a5 100644 --- a/test_package/CMakeLists.txt +++ b/test_package/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.3) project(PackageTest CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) -find_package(Threads) +find_package(Seasocks REQUIRED) add_executable(seasocks_test seasocks_test.cpp) -target_link_libraries(seasocks_test ${CONAN_LIBS} ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(seasocks_test PRIVATE Seasocks::seasocks) diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 74f93761..bdfb3233 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -4,7 +4,7 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "cmake", "cmake_find_package" def build(self): cmake = CMake(self)