Skip to content
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
6 changes: 5 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def set_version(self):
"with_zlib": [True, False],
}
default_options = {
"shared": True,
"shared": False,
"fPIC": True,
"with_zlib": True,
}
Expand Down Expand Up @@ -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()

Expand All @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down