From 6e12a55c92d3c81f051ded560e143a16c16a7139 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 3 May 2020 12:51:41 +0200 Subject: [PATCH] Better handling for static c linking. --- .drone.yml | 4 ++-- CMakeLists.txt | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.drone.yml b/.drone.yml index 1209d03..c4e3386 100644 --- a/.drone.yml +++ b/.drone.yml @@ -18,7 +18,7 @@ steps: CXX: clang++ commands: - conan remote add epsilon-public https://packages.p-epsilon.com/ - - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ . -B build-debug + - cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ . -B build-debug -DSTATICC=ON - cmake --build build-debug --target all -- -j 4 - build-debug/bin/pkmnLibTests -s --durations yes --use-colour yes - name: test-release-linux @@ -31,7 +31,7 @@ steps: CXX: clang++ commands: - conan remote add epsilon-public https://packages.p-epsilon.com/ - - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ . -B build-release + - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ . -B build-release -DSTATICC=ON - cmake --build build-release --target all -- -j 4 - build-release/bin/pkmnLibTests -s --durations yes --use-colour yes - name: valgrind-release-linux diff --git a/CMakeLists.txt b/CMakeLists.txt index beb21e8..b10f07c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,14 +33,19 @@ if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) list(GET VERSION_LIST 1 MINOR) if (NOT MINOR MATCHES 0) SET(VERSION ${VERSION}.${MINOR}) - endif() + endif () + set(CONAN_STATIC_C False) + if (STATICC) + set(CONAN_STATIC_C True) + endif (STATICC) + if (NOT WINDOWS) execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated - -s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -o *:staticC=True) - else() + -s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -o *:staticC=${STATICC}) + else () execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated - -s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -s os=Windows -o *:staticC=True) - endif() + -s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -s os=Windows -o *:staticC=${STATICC}) + endif () endif () include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup()