From d935b14548e5c9cd66d793cb0dbf6942d6477a57 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Tue, 31 Dec 2019 20:20:40 +0100 Subject: [PATCH] Changes to how CMake gets compiler version to pass onto Conan. --- CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9be0a9c..424ac35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,12 +23,16 @@ message(STATUS "Using: if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) message(WARNING "The file conanbuildinfo.cmake doesn't exist, running conan install.") - string(REPLACE "." ";" VERSION_LIST "${CMAKE_CXX_COMPILER_VERSION}") - list(GET VERSION_LIST 0 MAJOR) + string(REPLACE "." ";" VERSION_LIST "${CMAKE_C_COMPILER_VERSION}") + list(GET VERSION_LIST 0 VERSION) + list(GET VERSION_LIST 1 MINOR) + if (NOT MINOR MATCHES 0) + SET(VERSION ${VERSION}.{MINOR}) + endif() if (NOT WINDOWS) - execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build missing -s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${MAJOR}) + execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build missing -s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION}) else() - execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build missing -s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${MAJOR}) + execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build missing -s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION}) endif() endif () include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)