Support for building Static
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-05-02 12:31:04 +02:00
parent 2e227a2688
commit 517f95bfc5
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 11 additions and 1 deletions

View File

@ -5,7 +5,11 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
set(CMAKE_CXX_STANDARD 17)
file(GLOB_RECURSE SRC_FILES "src/*.cpp" "src/*.hpp")
add_library(Arbutils SHARED ${SRC_FILES})
if (SHARED)
add_library(Arbutils SHARED ${SRC_FILES})
else()
add_library(Arbutils STATIC ${SRC_FILES})
endif(SHARED)
set_target_properties(Arbutils PROPERTIES LINKER_LANGUAGE CXX)
if (WINDOWS)

View File

@ -19,6 +19,11 @@ class ArbutilsConan(ConanFile):
if self.settings.os == "Windows":
self.output.warn("Noticed Windows target, setting Cmake WINDOWS=On.")
cmake.definitions["WINDOWS"] = "On"
if self.options["shared"]:
self.output.info("Building shared library.")
cmake.definitions["SHARED"] = "On"
else:
self.output.info("Building static library.")
cmake.configure()
cmake.build()
@ -30,6 +35,7 @@ class ArbutilsConan(ConanFile):
self.copy("*.hpp", dst="include/Arbutils", src="src")
self.copy("*.dll", dst="bin", keep_path=False)
self.copy("*.so", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)
def package_info(self):
self.cpp_info.libs = ["Arbutils"]