[CMake] This has to have been asked before...
Oliver Smith
osmith at playnet.com
Mon Mar 8 14:11:52 EST 2010
On 3/6/2010 8:04 PM, J Decker wrote:
> there is a foreach() operator...
>
Well, thanks for trying, but what I actually want to know is how to add
something to all the current targets /automatically/ - as in without
specifying them by hand, and how to get the compiler flags etc of a
particular target so that I can /generate/ a custom command that matches
the given target.
get_file_component(pchbase ${PrecompiledHeader} NAME_WE)
get_file_component(pchpath ${PrecompiledHeader} PATH)
* foreach ( target in LISTS CMAKE_TARGET_LIST )*
set(pchname "${CMAKE_BINARY_DIR}/${pchbase}.${target}.h")
get_target_properties(defines ${target} COMPILE_DEFINITIONS)
get_target_properties(flags ${target} COMPILE_FLAGS)
set_target_properties(${target} PROPERTIES COMPILE_FLAGS
"${flags} -include ${pchname} -Winvalid-pch")
add_custom_command(${target} PRE_BUILD COMMAND
"ln -s ${pchname} ${PrecompiledHeader}"
"g++ ${defines} ${flags} -o ${pchname}.gch ${pchname}")
)
endforeach ()
Marked in bold is the part I'm struggling with.
- Oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100308/a3c36321/attachment-0001.htm>
More information about the CMake
mailing list