Modular building of kde modules

Pau Garcia i Quiles pgquiles at elpauer.org
Wed Mar 18 01:13:08 CET 2009


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 ) ?

dir/CMakeLists.txt <-- There is an INCLUDE( subdirectory/CMakeLists.txt ) here
dir/subdirectory/CMakeLists.txt

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)


More information about the Kde-buildsystem mailing list