[cmake-developers] [CMake 0015678]: CMakeCache.txt can't be passed into cmake's -C flag
Mantis Bug Tracker
mantis at public.kitware.com
Mon Aug 3 17:08:27 EDT 2015
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=15678
======================================================================
Reported By: Chris
Assigned To:
======================================================================
Project: CMake
Issue ID: 15678
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2015-08-03 17:08 EDT
Last Modified: 2015-08-03 17:08 EDT
======================================================================
Summary: CMakeCache.txt can't be passed into cmake's -C flag
Description:
I'm probably trying to be too clever, but I'm trying to setup a cmake build
target for clang to do a "bootstrap" build where you build clang, then use the
built clang to rebuild clang. I had this "genius" idea that I could try and pass
through the CMake options used to configure the first clang using the
CMakeCache.txt and the -C flag. It unfortunately doesn't work. I see the
following errors:
[2/5] Performing configure step for 'bootstrap'
FAILED: cd
/Users/cbieneman/dev/open-source/llvm-build-rel/tools/clang/bootstrap/src/bootstrap-build
&& /Users/cbieneman/dev/open-source/cmake-bins/bin/cmake -C
/Users/cbieneman/dev/open-source/llvm-build-rel/CMakeCache.txt
-DCMAKE_CXX_COMPILER=/Users/cbieneman/dev/open-source/llvm-build-rel/bin/clang++
-DCMAKE_CXX_COMPILER=/Users/cbieneman/dev/open-source/llvm-build-rel/bin/clang
"-GSublime Text 2 - Ninja" /Users/cbieneman/dev/open-source/llvm &&
/Users/cbieneman/dev/open-source/cmake-bins/bin/cmake -E touch
/Users/cbieneman/dev/open-source/llvm-build-rel/tools/clang/bootstrap/src/bootstrap-stamp/bootstrap-configure
loading initial cache file
/Users/cbieneman/dev/open-source/llvm-build-rel/CMakeCache.txt
CMake Error: Error in cmake code at
/Users/cbieneman/dev/open-source/llvm-build-rel/CMakeCache.txt:17:
Parse error. Expected a command name, got unquoted argument with text
"//Default".
CMake Error: Error processing file:
/Users/cbieneman/dev/open-source/llvm-build-rel/CMakeCache.txt
Steps to Reproduce:
Apply the diffs below to clang, and configure with CMake setting
-DCLANG_ENABLE_BOOTSTRAP=On, and run <buildtool> bootstrap.
Additional Information:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ab70f1d..6974b6e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -96,6 +96,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN
"Set to ON to force using an old, unsupported host toolchain." OFF)
+ option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF)
include(AddLLVM)
include(TableGen)
@@ -551,3 +552,31 @@ if (CLANG_BUILT_STANDALONE)
${CLANG_BINARY_DIR}/share/clang/cmake/ClangConfig.cmake
COPYONLY)
endif ()
+
+if (CLANG_ENABLE_BOOTSTRAP)
+ include(ExternalProject)
+
+ ExternalProject_Add(bootstrap
+ DEPENDS clang
+ PREFIX bootstrap
+ SOURCE_DIR ${CMAKE_SOURCE_DIR}
+ CMAKE_ARGS -C ${CMAKE_BINARY_DIR}/CMakeCache.txt
+ ${CLANG_BOOTSTRAP_CMAKE_ARGS}
+ -DCMAKE_CXX_COMPILER=${CMAKE_BINARY_DIR}/bin/clang++
+ -DCMAKE_CXX_COMPILER=${CMAKE_BINARY_DIR}/bin/clang
+ STEP_TARGETS configure build
+ )
+
+ ExternalProject_Add_Step(bootstrap force-reconfigure
+ DEPENDERS configure
+ ALWAYS 1
+ )
+
+ ExternalProject_Add_Step(bootstrap clobber
+ COMMAND ${CMAKE_COMMAND} -E remove_directory <BINARY_DIR>
+ COMMAND ${CMAKE_COMMAND} -E make_directory <BINARY_DIR>
+ COMMENT "Clobberring compiler-rt build directory..."
+ DEPENDERS configure
+ DEPENDS ${LLVM_RUNTIME_OUTPUT_INTDIR}/bootstrap
+ )
+endif()
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2015-08-03 17:08 Chris New Issue
======================================================================
More information about the cmake-developers
mailing list