Modular building of kde modules

Matthew Woehlke mw_triad at users.sourceforge.net
Wed Mar 18 00:22:26 GMT 2009


Pau Garcia i Quiles wrote:
> On Wed, Mar 18, 2009 at 1:03 AM, Matthew Woehlke
> <mw_triad at users.sourceforge.net> wrote:
>> Parker Coates wrote:
>>> I've often wished CMake had a construct equivalent to Python's "if
>>> __name__ == '__main__' :" that would let you run certain code only if
>>> the current file was being run as the "top level" CMakeLists.txt.
>> You mean like this?
>> if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
>> ?
>>
>> (Probably not the most elegant solution, but... bonus points for being
>> almost an exactly equivalent of the Python you mentioned ;-).)
> 
> Wouldn't that fail if there is a CMakeLists.txt doing INCLUDE(
> subdirectory/CMakeLists.txt ) ?

Maybe, but I expect that to break horribly :-). (Certainly I'd expect 
subdirectory/CMakeLists.txt to need to  know that it will be parsed this 
way, which sort-of obviates the need to check if you're top-level.)

-- 
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
-- 
You're on your own for the pony. -- Richard Hughes, on feature requests



More information about the kde-core-devel mailing list