[CMake] CMake equivalent to Boost.Build site-config.jam or user-config.jam

Craig Scott craig.scott at crascit.com
Wed Aug 9 08:30:38 EDT 2017


Something which may be helpful for projects which don't have direct support
for optional config is to hook into their project() command. You can set
the CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE
<https://cmake.org/cmake/help/latest/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.html#variable:CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE>
variable
to the name of a file to pull in as though via an include() command right
after the project() call that <PROJECT-NAME> corresponds to. No need to
modify the source code of the <PROJECT-NAME> project in any way, since
you're injecting another file from wherever you want to keep it.

On Wed, Aug 9, 2017 at 8:32 PM, Jean-Michaël Celerier <
jeanmichael.celerier at gmail.com> wrote:

> That's a very useful feature to have! Ideally CMake would also try to load
> it recursively up to the "/" folder just like for instance clang-format or
> clang-tidy look for their configuration folders upwards. This would allow
> for instance to easily build all the projects in a certain folder in
> release mode by default or stuff like this.
>
>
>
> -------
> Jean-Michaël Celerier
> http://www.jcelerier.name
>
> On Wed, Aug 9, 2017 at 12:20 PM, Cristian Adam <cristian.adam at gmail.com>
> wrote:
>
>>
>>
>> On Tue, Aug 8, 2017 at 8:08 PM, Brian Davis <bitminer at gmail.com> wrote:
>>
>>>
>>> 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 <initial-cache>
>>>
>>> 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
>>>
>>
>> There is the (undocumented) PreLoad.cmake
>> <https://gitlab.kitware.com/cmake/cmake/blob/master/Source/cmake.cxx#L1507>,
>> which acts like giving a precache file with -C command line argument.
>>
>> But, as it turns out, it doesn't work with server mode :(
>>
>> Cheers,
>> Cristian.
>>
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake
>>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
Craig Scott
Melbourne, Australia
https://crascit.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170809/f760e2f0/attachment-0001.html>


More information about the CMake mailing list