[CMake] How to determine origin of variable

Martin Weber m.weber at razorcat.com
Thu Aug 25 11:45:53 EDT 2011


Am 25.08.2011 17:39, schrieb David Cole:
> On Thu, Aug 25, 2011 at 7:34 AM, Martin Weber<m.weber at razorcat.com>  wrote:
>> Hi all,
>>
>> is there a way in CMake to detect, whether a variable has been set on the
>> command-line (with the -D option) and not in a CMakelists.txt?
>>
>> For example, GNU-make has the origin function do do something similar.
>>
>> Thanks,
>>   Martin
>>
>> --
>> ☂ E-Mails sollten Text sein, Text und nur Text.
>> Wenn Gott gewollt hätte, dass E-Mails in HTML geschrieben würden,
>> endeten Gebete traditionell mit</amen>.
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>
> No, there's no way to tell.
>
> Why do you ask?

My CMakelists.txt changes the value of CMAKE_INSTALL_PREFIX by replacing 
the trailing directory. But it should do this only if the user did not 
specify a value on the commandline.


-- 
E-Mails sollten Text sein, Text und nur Text.
Wenn Gott gewollt hätte, dass E-Mails in HTML geschrieben würden,
endeten Gebete traditionell mit </amen>.


More information about the CMake mailing list