From 4c48085840fe9314c6591a7f971e892c125e6b99 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 31 Jul 2020 17:38:28 +0200 Subject: [PATCH] Set shared library if so requested. --- CMakeLists.txt | 11 ++++++++--- conanfile.py | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dc96f5..0f4b255 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,12 +79,17 @@ if (SCRIPT_PROVIDER STREQUAL "angelscript") SET(_TESTLINKS angelscript ${_TESTLINKS}) endif () +# If we are building for Windows we need to set some specific variables. if (WINDOWS) - message(STATUS "Using Windows build.") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L ${CMAKE_BINARY_DIR}/bin") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition") + MESSAGE(WARNING, "Using Windows Build.") + # Add a definition for the compiler, so we can use it in C++ as well. + ADD_DEFINITIONS(-D WINDOWS=1) + # -m64: Build a 64 bit library + add_compile_options(-m64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-allow-multiple-definition") endif (WINDOWS) + if (STATICC) message(STATUS "Linking C library statically") SET(_LINKS ${_LINKS} -static-libgcc -static-libstdc++) diff --git a/conanfile.py b/conanfile.py index d9d8eec..fad42fa 100644 --- a/conanfile.py +++ b/conanfile.py @@ -20,6 +20,9 @@ class PkmnLibConan(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" if self.options.staticC: cmake.definitions["STATICC"] = "On" cmake.configure()