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

Robert Goulet Robert.Goulet at autodesk.com
Mon Jan 26 13:04:21 EST 2015


Do we really need to go down the road of making hlsl a 'first-class' language to add support for additional compile flags?

-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com] 
Sent: Monday, January 26, 2015 12:43 PM
To: Robert Goulet
Cc: cmake-developers at cmake.org
Subject: Re: [cmake-developers] Setting additional compile flags to .hlsl files?

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