Skip to content

Document PreLoad.CMake

As:

https://cmake.org/cmake/help/latest/search.html?q=Preload.cmake&check_keywords=yes&area=default

Yields no hits but as stated here the desired work flow:

https://cmake.org/pipermail/cmake/2017-August/066012.html

And restated here:

Is there a CMake equivalent to a site-config.jam or user-config.jam

http://www.boost.org/build/doc/html/bbv2/recipies/site-config.html

basically a CMake file the user can put in a project directory that CMake will read first when using cmake-gui that allows user to specify stuff they don't want to have to keep specifying in cmake-gui each "delete cache"

such as

set( CMAKE_INSTALL_PREFIX ${CURRENT_LIST_DIR}/install CACHE STRING "" FORCE) set( CMAKE_DEBUG_POSTFIX d CACHE STRING "" FORCE )

There is cmake.exe

-C

but requires command line

come to think of it would be nice if set( CMAKE_GENERATOR_PLATFORM "Visual Studio 12 2013 Win64" )

in desired user config file and CMake would just "make it so" on clicking Generate.

I can do this with my own projects, by implementing it myself, but when checking out 3rd party projs they can be all over the map on config allowing a user-config.cmake would provide mechanism to tame the config problems.

Desired workflow

  1. Checkout 3rd party proj

  2. put a CMakeUser.txt or whatever file per project

  3. Run CMake GUI Generate

  4. Click Open Project

  5. Change whatever manual bits in in gui

  6. Update project suing git witch branches versions

  7. Delete Cache

  8. Return to 3

  9. Doopy doopy doo whatever else

Well there is a solution to this need and it is:

Preload.cmake

see cmake.cxx:1507 : void cmake::PreLoadCMakeFiles()

And when working on a project like vmtk is:

set( CMAKE_INSTALL_PREFIX "C:/projects/4DRTProto/4DRTProto/install" CACHE STRING "" FORCE)
set( SUPERBUILD_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE STRING "" FORCE)
set( CMAKE_DEBUG_POSTFIX d CACHE STRING "" FORCE )

#set( CMAKE_GENERATOR_PLATFORM "Visual Studio 12 2013 Win64" )

So I find this very useful (read time/mistake saving). Maybe others would too if it were documented.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information