[CMake] VC2005 - ADD_CUSTOM_TARGET problems..

Shishir Ramam sramam at gmail.com
Thu May 26 13:48:03 EDT 2005


Hi,
I have a project with a structure as below (directory strucutre
interspersed with
the commands in the CMakeLists.txt):

root/
     PROJECT(MyProject)
     subdir1/src 
                     ADD_EXECUTABLE(target1 target1_srcs.c)  
                     # target1 generates a header file - say gen_header.h
     subdir2/
                ADD_EXECUTABLE(target2 target2_srcs.c)

target2 includes gen_header.h So my interest is in building and running target1
before attempting to build target2. 

I am attempting to achieve this by using either of - ADD_CUSTOM_COMMAND 
or ADD_CUSTOM_TARGET.

Under subdir1/src
        ADD_CUSTOM_TARGET ( RunTarget1
 	    ALL
 	    ${EXE_DIR}/target1  arg1 arg2 
 	    DEPENDS target1
 	)

or 
        ADD_CUSTOM_COMMAND(
	   TARGET target1
	   POST_BUILD
	   COMMAND ${EXE_DIR}/targe1
	   ARGS arg1 arg2
	   COMMENT "Run mk_errinfo to generate err_codes.h and err_data.h"
	)

In both cases, as soon as the command is added in, VC2005 CPU usage seems
to go way up - 85%+, even for just loading the project. The build
completes successfully,
but the CPU usage stays very high. 

Hand genertating the necessary input, and attempting to build the
project twice,
VC2005 does not  hog the CPU.

I seem to be doing everything correctly to the best of my understanding. 
This also seems to match up to the use of these commands in the Modules
section.

It's likely I have missed a fundamental point about the usage of these commands
or encountered a bug. Would appreciate any help with figuring which and how 
I can best get around it. 

thanks,
-shishir

 -- 
The man who doesn't read good books has no advantage over the man who
can't read them. - Mark Twain


More information about the CMake mailing list