[CMake] VS.NET generation...

Lars Pechan lars.pechan at parkerpechan.com
Mon Nov 1 18:48:18 EST 2004


Hi there,
I have two questions about the VS.NET 2003 generator:

Q1) LIBRARY/EXECUTABLE_OUTPUT_PATH
I use this to make sure some exes and libs end up where I want them. 
During the build I then need to run some of the utilities that have 
been created in earlier steps.  Essentially I do

SET(EXEDIR ${Proj_BINARY_DIR}/exe)

ADD_EXECUTABLE(foo ${fooSources})
SET(EXECUTABLE_OUTPUT_PATH ${EXEDIR})

and then invoke foo.exe by running

COMMAND ${EXEDIR}/foo

in a custom command later.

Using NMake Makefiles this works fine. Using the VS.NET generator 
though changes my EXE dir to ${EXE}/Release for a Release build and 
${EXE}/Debug for a Debug build. foo.exe ends up in ${EXE}/Release.

Now when I need to run foo.exe later it is not found. My CUSTOM_COMMAND 
refers to it as ${EXE}/foo but it isn't there, it's in ${EXE}/Release.

So how can I reference an executable produced in the project itself 
without hacking CMakeLists.txt for different buildstyles or something 
equally unmaintainable?


Q2) Suppressing _DEBUG from a debug build.
As far as I can see either the CMake generator or VS.NET itself 
automatically adds _DEBUG to the preprocessor settings for a project. 
This leads to linking being done against /MTd which contains the debug 
routines for malloc etc.

The project I'm converting has to be linked against /MT so I tried 
doing a REMOVE_DEFINITIONS(-D_DEBUG) (also tried /D_DEBUG and just 
_DEBUG) but the symbol is still defined.

Is there any way around this?

Thanks

/Lars



More information about the CMake mailing list