[CMake] Build different targets depending on build configuration

Steven Dwyer steven.dwyer at shoutresearch.com
Mon Aug 18 11:01:22 EDT 2008


I should clarify my original question,

Our unit/functional tests appear in the same files as the source they're exercising (we use ifdefs to control if they're compiled in or not).

I think you're suggesting that we add new targets for each existing configuration (e.g. Debug outputs program.exe and program-test.exe) whereas I'd rather use configurations (e.g. Debug outputs program.exe and Test outputs program.exe)

I think this is required because of the need to ifdef in/out the test code.

I did look through the links you suggested and will definitely spend more time looking at them.

Steven

-----Original Message-----
From: Mike Jackson [mailto:mike.jackson at imts.us]
Sent: August 18, 2008 10:04 AM
To: Steven Dwyer
Cc: cmake at cmake.org
Subject: Re: [CMake] Build different targets depending on build configuration


> 2.  If the Debug/Release configurations build an executable, the
> test configuration should also build an executable and run it after
> it is built.

I use the Boost unit testing framework and what I do is add "testing"
targets that build my unit tests (optionally) every time I compile.
After the compile I run "make test" and all the units tests are
executed.

> 3.  If the Debug/Release configurations build a library, the test
> configuration should build an executable and run it after it is built.

Same idea as #2. There are some pointers in the CMake wiki about
setting all this up but just keep asking questions here as you will
find the cmake community very willing to help.



More information about the CMake mailing list