[cfe-dev] CMake CACHE variables heads-up for 3.4

Alp Toker alp at nuanti.com
Mon Nov 11 18:13:11 PST 2013


Update: It turns out this is a CMake bug/limitation.

I've reported it on their tracker at
http://www.cmake.org/Bug/view.php?id=14546 (accepted as a desired
enhancement) and have a patch in the works. Will post here as well as to
cmake.org when it's ready.

In the meantime, keep in mind that values including build flags,
filesystem paths and the clang version number will persist even when
changed in SVN and even if you used defaults.

Alp.


On 30/10/2013 17:51, Alp Toker wrote:
> Hello,
>
> You may have noticed CMake-built versions of clang with unusual
> executable versions, for example a current TOT clang just got built as
> clang-3.2/libclang.3.2.dylib and another machine tracking LLVM SVN head
> is getting built under bin/clang-3.3 even after make clean.
>
> This seems to have been causing confusion in LLVM.org bug reports for
> some time..
>
> It turns out this happens because CLANG_EXECUTABLE_VERSION is set as a
> CACHE variable in CMakeLists.txt. So value gets cached to whatever the
> version was the *first time* you built LLVM and arbitrarily persists
> through version upgrades -- probably not what anyone wants. Likewise the
> libclang shared objects will get installed using whatever this value is
> in your cache.
>
> I'm planning to make at least CLANG_EXECUTABLE_VERSION and
> LIBCLANG_LIBRARY_VERSION ordinary CMake variables in time for the new
> release. This means if you're tracking LLVM 3.4 and relying on (or
> shipping!) the binary installed as clang-3.1, clang-3.2 or clang-3.3
> it's now going to change to clang-3.4 in line with the configure-based
> system.
>
> You'll still be able to tweak all the variables for your custom vendor
> distribution as usual using -DCLANG_EXECUTABLE_VERSION etc. or with the
> CMake GUI -- this change will just remove the hidden storage, but I
> wanted to give a heads up in case anyone is relying on that behaviour.
>
> Incidentally there are various other CACHE variables in LLVM's build
> system, but they seem less problematic..
>
>
> CMakeLists.txt:  set(CLANG_PATH_TO_LLVM_SOURCE "" CACHE PATH
> CMakeLists.txt-    "Path to LLVM source code. Not necessary if using an
> installed LLVM.")
> CMakeLists.txt:  set(CLANG_PATH_TO_LLVM_BUILD "" CACHE PATH
> CMakeLists.txt-    "Path to the directory where LLVM was built or
> installed.")
> CMakeLists.txt-
> --
> CMakeLists.txt-    set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT}
> --no-progress-bar")
> CMakeLists.txt-  endif()
> CMakeLists.txt:  set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING
> "Default options for lit")
> CMakeLists.txt-
> CMakeLists.txt-  set( CMAKE_RUNTIME_OUTPUT_DIRECTORY
> ${CMAKE_BINARY_DIR}/bin )
> --
> CMakeLists.txt-endif()
> CMakeLists.txt-
> CMakeLists.txt:set(CLANG_RESOURCE_DIR "" CACHE STRING
> CMakeLists.txt-  "Relative directory from the Clang binary to its
> resource files.")
> CMakeLists.txt-
> CMakeLists.txt:set(C_INCLUDE_DIRS "" CACHE STRING
> CMakeLists.txt-  "Colon separated list of directories clang will search
> for headers.")
> CMakeLists.txt-
> CMakeLists.txt:set(GCC_INSTALL_PREFIX "" CACHE PATH "Directory where gcc
> is installed." )
> CMakeLists.txt:set(DEFAULT_SYSROOT "" CACHE PATH
> CMakeLists.txt-  "Default <path> to all compiler invocations for
> --sysroot=<path>." )
> CMakeLists.txt-
> CMakeLists.txt:set(CLANG_VENDOR "" CACHE STRING
> CMakeLists.txt-  "Vendor-specific text for showing with version
> information.")
> CMakeLists.txt-
> --
> CMakeLists.txt-endif()
> CMakeLists.txt-
> CMakeLists.txt:set(CLANG_REPOSITORY_STRING "" CACHE STRING
> CMakeLists.txt-  "Vendor-specific text for showing the repository the
> source is taken from.")
> CMakeLists.txt-
> --
> CMakeLists.txt-endif()
> CMakeLists.txt-
> CMakeLists.txt:set(CLANG_VENDOR_UTI "org.llvm.clang" CACHE STRING
> CMakeLists.txt-  "Vendor-specific uti.")
> CMakeLists.txt-
> --
> CMakeLists.txt-# Clang version information
> CMakeLists.txt-set(CLANG_EXECUTABLE_VERSION
> CMakeLists.txt:     "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}"
> CACHE STRING
> CMakeLists.txt-    "Version number that will be placed into the clang
> executable, in the form XX.YY")
> CMakeLists.txt-set(LIBCLANG_LIBRARY_VERSION
> CMakeLists.txt:     "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}"
> CACHE STRING
> CMakeLists.txt-    "Version number that will be placed into the libclang
> library , in the form XX.YY")
> CMakeLists.txt-mark_as_advanced(CLANG_EXECUTABLE_VERSION
> LIBCLANG_LIBRARY_VERSION)
> --
> CMakeLists.txt-endif()
> CMakeLists.txt-
> CMakeLists.txt:set(BUG_REPORT_URL "http://llvm.org/bugs/" CACHE STRING
> CMakeLists.txt-  "Default URL where bug reports are to be submitted.")
> CMakeLists.txt-
> CMakeLists.txt:set(CLANG_ORDER_FILE "" CACHE FILEPATH
> CMakeLists.txt-  "Order file to use when compiling clang in order to
> improve startup time.")
>
>
> Alp.
>
>

-- 
http://www.nuanti.com
the browser experts




More information about the cfe-dev mailing list