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

Richard Smith richard at metafoo.co.uk
Wed Oct 30 13:05:55 PDT 2013


On Wed, Oct 30, 2013 at 11:19 AM, Alp Toker <alp at nuanti.com> wrote:

>
> On 30/10/2013 17:58, Rafael EspĂ­ndola wrote:
> > So the variable will be updated at every run of cmake, but this will
> > not cause cmake to run at every ninja/make invocation, right?
>
> No, it'll still be an ordinary configure variable.
>

To clarify, do you mean:

If a user never overrides CLANG_EXECUTABLE_VERSION, then changing the
LLVM_VERSION_MAJOR and LLVM_VERSION_MINOR variables in llvm/CMakeLists.txt
will change the version number we use when building clang.

If a user overrides CLANG_EXECUTABLE_VERSION, then their overridden value
will be kept whenever cmake is rerun (for instance, when the LLVM version
number changes).


> The difference is that the value won't get stuck behind when the version
> in SVN/git changes, such as when you're doing a rebase locally or when
> 3.4 gets released.
>
> To see what I mean, try building the previous three stable clang
> releases in your ordinary location -- odds are, they'll all be built as
> clang-3.4 and libclang.3.4.dylib/so.
>
> The previous behaviour meant that CMake was saving whatever the version
> number was the first time you built your SVN checkout, possibly years
> ago, and never updating it again which is a foreign concept to say the
> least :-)


The previous behavior seems to be a bug to me. Please do fix it!


> > On 30 October 2013 13:51, Alp Toker <alp at nuanti.com> 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
> >>
> >> _______________________________________________
> >> cfe-dev mailing list
> >> cfe-dev at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
> --
> http://www.nuanti.com
> the browser experts
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131030/cdf14ce5/attachment.html>


More information about the cfe-dev mailing list