[Cmake] Adding a debug switch with CMake

Neil Killeen Neil . Killeen at atnf . csiro . au
Thu, 12 Jun 2003 11:37:05 +1000 (EST)


Bill, Andy

On Wed, 11 Jun 2003, Bill Hoffman wrote:

> You could have the custom target change directories to the top of the project then
> run cmake from the top, then cd back to the current directory and issue a make.
>
>
> ADD_CUSTOM_TARGET(debug  "cd ${PROJECT_BINARY_DIR};
> ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE:STRING=Debug ${PROJECT_SOURCE_DIR};
> cd ${PROJECT_BINARY_DIR}/ThisDir; make")
>
> Then add this command into each directory of your project.
> Then you could just run "make debug" in any directory.   It would
> change all the makefiles, but would only run make in the local directory,
> so you should get the behavior you want.
>
> -Bill
>

the thing i really wanted to avoid was the total regeneration of the
makefiles as that is rather time consuming.  If every time one issued

% make debug

in some directory it reruns cmake etc I dont think that would be
acceptable. if it has to be done,  i'd rather the developer does this just
once and then once again after to go back to optimized makefiles.
also having to  put this command in every directory is not elegant.

so thanks for the explanations and suggestions, but I will stick with
the one-time regeneration for now and instruct the programming team
not to write any bugs !

BTW, I can never find any documentation for the list of available commands
with cmake under the -E switch.

I did discover by chance that

% cmake -E

will list them, but you can't do that if you don't even know the -E switch
exists (which you don't until someone tells you).

regards
Neil