From ecb17a8bada11ff8026f1ceb869bc63a870a9973 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Wed, 1 Jan 2020 13:02:00 +0100 Subject: [PATCH] Allow setting for Windows build in Conan. --- CMakeLists.txt | 18 +++++++++--------- conanfile.py | 5 +++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75b38c7..19cd267 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,9 +8,16 @@ project(CreatureLib) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) +if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + conan_basic_setup() +else () + message(WARNING "The file conanbuildinfo.cmake doesn't exist, you have to run conan install first") +endif () + if (WINDOWS) ADD_DEFINITIONS(-D WINDOWS=1) -endif(WINDOWS) +endif (WINDOWS) # Create Core library with files in src/Core file(GLOB_RECURSE CORE_SRC_FILES "src/Core/*.cpp" "src/Core/*.hpp") @@ -56,11 +63,4 @@ if (NOT DEFINED CONAN_EXPORTED) MESSAGE(WARNING, "Called from Conan. Not building test build.") # Add a definition for the test library target_compile_definitions(CreatureLibTests PRIVATE TESTS_BUILD) -endif () - -if (EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - conan_basic_setup() -else () - message(WARNING "The file conanbuildinfo.cmake doesn't exist, you have to run conan install first") -endif () +endif () \ No newline at end of file diff --git a/conanfile.py b/conanfile.py index 0b27198..bc1bfad 100644 --- a/conanfile.py +++ b/conanfile.py @@ -7,14 +7,15 @@ class CreatureLibConan(ConanFile): url = "https://git.p-epsilon.com/Deukhoofd/CreatureLib" description = "The core implementation for turn based battling using creatures." settings = "compiler" - options = {"shared": [True, False]} - default_options = {"shared": True} + options = {"shared": [True, False], "windows": [True, False]} + default_options = {"shared": True, "windows": False} generators = "cmake" exports_sources = "*" compiler = "clang" def build(self): cmake = CMake(self) + cmake.definitions["WINDOWS"] = self.settings.get_safe("windows") cmake.configure() cmake.build()