[CMake] scope of set_source_files_properties?

Simmons, Aaron asimmons at rosettastone.com
Fri Mar 19 18:42:50 EDT 2010


I'm having trouble using set_source_files_properties from a subdirectory.  Say I have a top-level CMakeLists.txt like this:
        cmake_minimum_required(VERSION 2.8)
        project(test)
        add_subdirectory(subdir)
        get_source_file_property( temp subdir/test.c COMPILE_FLAGS )
        message("reading property from toplevel= ${temp}")

and I have a subdir/CMakeLists.txt like this:
        set_source_files_properties( subdir/test.c PROPERTIES COMPILE_FLAGS "-DBLAHBLAH")
        get_source_file_property( temp subdir/test.c COMPILE_FLAGS )
        message("reading property from subdir= ${temp}")

then the output of cmake will be:
        reading property from subdir= -DBLAHBLAH
        reading property from toplevel= NOTFOUND

Are source file properties inherently local scope?  Is there any way to specify the scope (like you can for the "set" function)?



Thanks,
aaron


More information about the CMake mailing list