Check CMAKE_CXX_COMPILER_ID when selecting default vespa-deps prefix
and llvm version on Darwin.
@@ -32,16 +32,12 @@ endfunction()
function(setup_vespa_default_build_settings_darwin)
message("-- Setting up default build settings for darwin")
- if(VESPA_COMPILER_VARIANT STREQUAL "gcc")
- set(DEFAULT_VESPA_LLVM_VERSION "8" PARENT_SCOPE)
- elseif(VESPA_COMPILER_VARIANT STREQUAL "clang")
- set(DEFAULT_LLVM_INCLUDE_DIRECTORY "/usr/local/opt/llvm/include")
- set(DEFAULT_LLVM_LINK_DIRECTORY "/usr/local/opt/llvm/lib")
- set(DEFAULT_VESPA_LLVM_VERSION "9" PARENT_SCOPE)
- elseif(VESPA_COMPILER_VARIANT STREQUAL "appleclang")
+ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
set(DEFAULT_LLVM_INCLUDE_DIRECTORY "/usr/local/opt/llvm/include")
set(DEFAULT_LLVM_LINK_DIRECTORY "/usr/local/opt/llvm/lib")
set(DEFAULT_VESPA_LLVM_VERSION "9" PARENT_SCOPE)
+ else()
+ set(DEFAULT_VESPA_LLVM_VERSION "8" PARENT_SCOPE)
endif()
set(DEFAULT_CMAKE_PREFIX_PATH "${VESPA_DEPS}" "/usr/local/opt/bison" "/usr/local/opt/flex" "/usr/local/opt/openssl@1.1" PARENT_SCOPE)
set(DEFAULT_EXTRA_LINK_DIRECTORY "${VESPA_DEPS}/lib" "/usr/local/opt/bison/lib" "/usr/local/opt/flex/lib" "/usr/local/opt/icu4c/lib" "/usr/local/opt/openssl@1.1/lib")
@@ -118,9 +114,9 @@ function(vespa_use_default_build_settings)
set(DEFAULT_VESPA_USER "$ENV{USER}")
endif()
if(APPLE)
- if(VESPA_COMPILER_VARIANT STREQUAL "clang")
+ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(VESPA_DEPS "/opt/vespa-deps-clang")
- elseif(VESPA_COMPILER_VARIANT STREQUAL "appleclang")
+ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
set(VESPA_DEPS "/opt/vespa-deps-appleclang")
endif()
endif()
@@ -244,11 +240,7 @@ function(vespa_use_default_cxx_compiler)
endif()
unset(DEFAULT_CMAKE_C_COMPILER)
unset(DEFAULT_CMAKE_CXX_COMPILER)
- if(NOT DEFINED VESPA_COMPILER_VARIANT)
- set(VESPA_COMPILER_VARIANT "gcc")
- set(VESPA_COMPILER_VARIANT "gcc" PARENT_SCOPE)
- endif()
- if(VESPA_COMPILER_VARIANT STREQUAL "gcc")
+ if(NOT DEFINED VESPA_COMPILER_VARIANT OR VESPA_COMPILER_VARIANT STREQUAL "gcc")
if(APPLE)
set(DEFAULT_CMAKE_C_COMPILER "/usr/local/bin/gcc-9")
set(DEFAULT_CMAKE_CXX_COMPILER "/usr/local/bin/g++-9")
