[cmake-developers] Setting additional compile flags to .hlsl files?

Brad King brad.king at kitware.com
Mon Jan 26 12:42:44 EST 2015


On 01/26/2015 12:20 PM, Robert Goulet wrote:
> set_source_files_properties(${SHADER_FILE} PROPERTIES COMPILE_FLAGS "/I${CMAKE_SOURCE_DIR}/src")
> and it didn't get written to the .vcxproj file at all.

Right now .hlsl files are written by

 cmVisualStudio10TargetGenerator::WriteExtraSource

because they are (perhaps incorrectly) not classified as
compiled sources.  Look at use of GetObjectSources in
cmVisualStudio10TargetGenerator::WriteAllSources for where
compiled sources get handled.  The OutputSourceSpecificFlags
method handles source-specific COMPILE_FLAGS.

The reason .hlsl files are not classified as compiled sources
is because HLSL is not a first-class language in CMake that
one enables via enable_language().  This also prevents them
from being handled by non-VS generators.  If you are
interested in working on making HLSL a first-class language
I can help you get started.

-Brad



More information about the cmake-developers mailing list