[CMake] scope of set_source_files_properties?

Brad King brad.king at kitware.com
Tue Mar 23 08:33:25 EDT 2010


Simmons, Aaron wrote:
>Am I missing something?  The code is below...
> 
> Top-level CMakeLists.txt:
>         cmake_minimum_required(VERSION 2.8)
>         project(test)
> 
>         set(src ${CMAKE_CURRENT_SOURCE_DIR}/subdir/test.c)
> 
>         add_subdirectory(subdir)
>         get_source_file_property( temp ${src} COMPILE_FLAGS )

Due to historical development reasons, source file properties
are scoped only in the directory where they are set.  Only
targets created by an add_exectuable, add_library, or
add_custom_target commands in the *same* directory (not even
a subdirectory) can see the property of a source file.

-Brad


More information about the CMake mailing list