Discussion:
[cmake-developers] The "cmake_host_system_information" Command
Taylor Holberton
2018-09-02 00:50:10 UTC
Permalink
Hello!

I noticed, since 3.10, there's been several new additions to the query key
list of this command.
I understand the idea behind this command is to request information that is
non-trivial to access.
For example, FQDN takes a little bit longer than the others.

I think ideally, all variables could be accessed the same way - with a
${key} expansion.
Simple is better.

I found what I think is the class of a variable definition on GitHub.

https://github.com/tay10r/CMake/blob/dc70284c811a3183295371903d965658a9d2f8e0/Source/cmDefinitions.h#L44

If you generalize the class a bit more, you can create non-trivial
variables that make queries
when they are expanded. I made a gist demonstrating what I mean.

https://gist.github.com/tay10r/ba9f77008581732cc074c35a55d264e7
Brad King
2018-09-04 12:29:23 UTC
Permalink
create non-trivial variables that make queries when they are expanded
I understand the proposal but I don't think we should do that.
The variable expansion logic is already one of the hottest
parts of the code shown in profiling. Adding dispatch for
special variables will only make it slower for everything else.

Also, it is not unreasonable for long operations to be called out
by more explicit commands in the code.

Furthermore, some queries may have parameters. The command can
do that. Squeezing everything into a variable name won't work
well.

-Brad
--
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:
https://cmake.org/mailman/listinfo/cmake-developers
Loading...