[CMake] add_test and $(Configuration) with Visual Studio Generator
Kelly Thompson
kgt at lanl.gov
Wed Jul 21 10:48:08 EDT 2010
Thanks Mike!
That work like a charm. I'm not sure why I overlooked that portion of the
user manual. Thanks for being patient.
-kt
> -----Original Message-----
> From: Michael Wild [mailto:themiwi at gmail.com]
> Sent: Tuesday, July 20, 2010 2:00 PM
> To: Kelly Thompson
> Cc: cmake at cmake.org
> Subject: Re: [CMake] add_test and $(Configuration) with Visual Studio
> Generator
>
> On 20. Jul, 2010, at 21:39 , Kelly Thompson wrote:
>
> > Hi,
> >
> >
> >
> > I am having trouble with add_test and the MSVC macro $(Configuration)
when
> I
> > generate project files for Visual Studio. I am hoping someone on this
> list
> > can provide a solution.
> >
> >
> >
> > Scenario: (This is an outline of what I want to do.)
> >
> >
> >
> > 1. Ceating a unit test via 'add_executable(unittest unittest.cc)'.
> >
> > 2. Add a the test so that it runs under a script that takes the unit
> > test's fully qualified path as an argument. That is, I use 'add_test(
> > myunittest c:\bin\mytestscript ${path_to_unittest}/unittest.exe )'
> >
> >
> >
> > So the question is: how do I define ${path_to_unittest}. I was trying
to
> > use 'get_target_property( unittest_loc unitttest LOCATION ),' but this
> > provides a path that contains the Visual Studio Macro $(Configuration)
> which
> > is not converted into 'Debug/Release/.' when I run the unit tests inside
> of
> > visual studio. Instead I get an error about the path not being found
> (i.e:
> > 'c:\myproj\test\$(Configuration)\unittest.exe not found').
> >
>
>
> See http://cmake.org/cmake/help/cmake-2-8-docs.html#command:add_test.
>
> add_test(NAME myunittest COMMAND c:/bin/mytestscript
> $<TARGET_FILE:unittest>)
>
> should hopefully do what you need.
>
>
> >
> >
> > Does anyone have an example of how to use add_test in the way that I am
> > trying to use it? I suppose I could create a custom command that runs a
> > build time and does a find_file(.) but I think there must be a better
way.
> >
> >
> >
> > Thanks in advance,
> >
> >
> >
> > -kt
>
> Michael
More information about the CMake
mailing list