From a851090dec8600b38d54cd65264e4146ad02b1e0 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 27 Aug 2019 20:55:11 +0200 Subject: [PATCH] build: third-party: enable CXX language earlier (#10862) This is required for `CMAKE_CXX_COMPILER` to be set already, not only after including third-party/cmake/BuildGperf.cmake. Closes https://github.com/neovim/neovim/pull/10860. Ref: 31f879983f --- third-party/CMakeLists.txt | 12 ++++++++++-- third-party/cmake/BuildGperf.cmake | 1 - 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 3bfa3fdf39..849b66742e 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -97,11 +97,19 @@ else() set(DEPS_C_COMPILER "${CMAKE_C_COMPILER}") endif() -set(DEPS_CXX_COMPILER "${CMAKE_CXX_COMPILER}") +if(USE_BUNDLED_GPERF) + enable_language(CXX) +endif() + +if(CMAKE_CXX_COMPILER) + set(DEPS_CXX_COMPILER "${CMAKE_CXX_COMPILER}") +endif() if(CMAKE_OSX_SYSROOT) set(DEPS_C_COMPILER "${DEPS_C_COMPILER} -isysroot${CMAKE_OSX_SYSROOT}") - set(DEPS_CXX_COMPILER "${DEPS_CXX_COMPILER} -isysroot${CMAKE_OSX_SYSROOT}") + if(DEPS_CXX_COMPILER) + set(DEPS_CXX_COMPILER "${DEPS_CXX_COMPILER} -isysroot${CMAKE_OSX_SYSROOT}") + endif() endif() # Cross compiling: use these for dependencies built for the diff --git a/third-party/cmake/BuildGperf.cmake b/third-party/cmake/BuildGperf.cmake index e922f71ed5..71c3cc1eef 100644 --- a/third-party/cmake/BuildGperf.cmake +++ b/third-party/cmake/BuildGperf.cmake @@ -2,7 +2,6 @@ # cross compiling we still want to build for the HOST system, whenever # writing a recipe that is meant for cross-compile, use the HOSTDEPS_* variables # instead of DEPS_* - check the main CMakeLists.txt for a list. -enable_language(CXX) # BuildGperf(CONFIGURE_COMMAND ... BUILD_COMMAND ... INSTALL_COMMAND ...) # Reusable function to build Gperf, wraps ExternalProject_Add.