Reputation: 1623
I have a bunch of targets and I'm trying to set the include directories on a per target basis.
set_target_properties (foo PROPERTIES INCLUDE_DIRECTORIES ${CMAKE_Fortran_MODULE_DIRECTORY}/bar)
When I build (make VERBOSE=1
) this on Mac OS X I get
... -J../build/modules/foo -I../build/modules/bar
When I do the same on Linux I get
... -J../build/modules/foo ...
The only difference I can see is that on the mac I'm using cmake 2.8.8 while on linux I'm using 2.8.7. Is this not supported on previous versions before 2.8.8?
Upvotes: 6
Views: 4344
Reputation: 54619
This behavior is indeed to the version change from 2.8.7 to 2.8.8.
From the changelog:
Call ExpandVariablesInString for each target's INCLUDE_DIRECTORIES
Update the documentation regarding INCLUDE_DIRECTORIES. [...]
Keep the INCLUDE_DIRECTORIES target property up to date.
Extract and use the INCLUDE_DIRECTORIES target properties.
Of particular interest is the commit changing the documentation. According to this the INCLUDE_DIRECTORIES
property in 2.8.7 was a read-only property on directories. The target property did not exist at all in that version.
Since setting arbitrary target properties is allowed by CMake your script still works without errors, but the property is simply ignored by CMake.
This is another great example why you should always take care of specifying the correct minimum required version.
Upvotes: 5