[CMake] VS.NET generation...
Lars Pechan
lars.pechan at parkerpechan.com
Tue Nov 9 21:59:03 EST 2004
Hi Brad,
I've had a look at this again and now I have the following situation:
1) Using ${CMAKE_CFG_INTDIR} I can indeed generate and correctly build
my project using the VS.NET 2003 generator (well, almost, there is one
subdirectory/project that VS.NET stubbornly refuses to open).
2) The same project using the NMake Makefiles generator however will
not work. I have one CMakeLists.txt where ${CMAKE_CFG_INTDIR} suddenly
starts evaluating to '' (i.e. empty) instead of '\.'. It correctly
evaluates to '\.' when I generate a bunch of custom commands for source
generation, eg
SET(copy2exeFiles ${CMDS}
${CHARSET}
)
FOREACH(cpFile ${copy2exeFiles})
ADD_CUSTOM_COMMAND(
OUTPUT ${EXEDIR}/${CMAKE_CFG_INTDIR}/${cpFile}
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${GENDIR}/${cpFile}
${EXEDIR}/${CMAKE_CFG_INTDIR}/${cpFile}
DEPENDS ${GENDIR}/${cpFile}
)
ENDFOREACH(cpFile)
The generated Makefile correctly contains the rules:
D:\builddir\exe\.\cmds.xml : ...
...
D:\builddir\exe\.\chars.xml : ...
...
Immediately after this in the CMakeLists.txt file I have another custom
command that depends on these generated files:
ADD_CUSTOM_COMMAND(
OUTPUT ${GENDIR}/Funcs
COMMAND ${EXEDIR}/${CMAKE_CFG_INTDIR}/myexe
ARGS -v
DEPENDS ${EXEDIR}/${CMAKE_CFG_INTDIR}/${SSCMDS}
${EXEDIR}/${CMAKE_CFG_INTDIR}/${CHARSET}
)
The generated Makefile has now completely forgotten about
${CMAKE_CFG_INTDIR} and the generated rule looks like this:
d:\builddir\gendir\Funcs: d:\builddir\exe\cmds.xml
d:\builddir\gendir\Funcs: d:\builddir\exe\chars.xml
@echo Building ...
d:\builddir\exe\myexe -v
Now the build fails since there is no rule to build
d:\builddir\exe\cmds.xml. There is of course a rule for
d:\builddir\exe\.\cmds.xml but that won't match.
Wildly guessing, perhaps there is some sort of optimisation of the path
going on (a la p1\.\p2 == p1\p2) whereas for VS.NET it does work since
CMAKE_CFG_INTDIR represents a 'proper' directory (i.e. 'Release',
'Debug'). Is there a way I can explicitly set CMAKE_CFG_INTDIR in some
carefully chosen location to some other value than '\.' to see if that
helps?
I'll be happy to send you the whole file if you like.
Regards,
/Lars
On 3/11/2004, at 12:48 AM, Brad King wrote:
> Lars Pechan wrote:
>> OK, what is the scope of the TARGET_PROPERTY (relating to the example
>> in the faq.) I'm guessing ${MY_GENERATOR_EXE} is valid in the same
>> CMakeLists.txt file and (possibly) in its subdirs? Also guessing that
>> if I'm to use ${MY_GENERATOR_EXE} in a sibling directory to where it
>> was defined that won't work. Which means I'll have to resort to
>> CMAKE_CFG_INTDIR.
>
> You are correct, the target properties are scoped to anything that can
> see the ADD_* command for the target and the SET_TARGET_PROPERTIES
> command that sets the property. We do have plans to make the scope
> more global to solve the problem you mention, but that is more of a
> long term change. For now you will have to use CMAKE_CFG_INTDIR.
>
> -Brad
More information about the CMake
mailing list