I need to add a custom command that varies based on configuration (with VS2010 
generator).  As far as I can see no direct way exists to do this.

I have tried to use the $<..> syntax but it keeps quoting the expression

add_library (foo SHARED IMPORTED GLOBAL)
set_target_properties(foo PROPERTIES
IMPORTED_CONFIGURATIONS "Release;Debug"
IMPORTED_LOCATION_RELEASE "/D /E /F"
IMPORTED_LOCATION_DEBUG " /A /B /C"
)
ADD_CUSTOM_COMMAND(
OUTPUT "${afile}.cpp"
COMMAND ${MY_PROGRAM} ARGS $<TARGET_FILE:foo>  -c "${afile}"
)
Results in
"myprogram.exe" "/A /B /C" "-c" "file.in"

I believe I will now have to write a batch script from cmake as a helper to 
correctly set the correct arguments.

Has anyone else had this issue?  Does anyone have a solution that worked?

Would it be possible to expand the $<...> syntax to support any cmake variable 
and do things like $<CMAKE_CXX_FLAGS_$<Configuration>>?

--
Alan LaViolette
Software Engineering Consultant
OVERWATCH
An Operating Unit of Textron Systems
21660 Ridgetop Circle, Suite 110
Sterling, VA 20166
Office: (703) 437-7651 x 2419
Fax: (703) 437-0039
alaviole...@overwatch.textron.com<mailto:alaviole...@overwatch.textron.com>
www.overwatch.com

"WARNING: Documents that can be viewed, printed or retrieved from this E-Mail 
may contain technical data whose export is restricted by the Arms Export 
Control Act (Title 22, U.S.C., Sec 2751, et seq,) or the Export Administration 
Act of 1979, as amended, Title 50, U.S.C., App. 2401 et seq. and which may not 
be exported, released or disclosed to non-U.S. persons (i.e. persons who are 
not U.S. citizens or lawful permanent residents ["green card" holders]) inside 
or outside the United States, without first obtaining an export license.  
Violations of these export laws are subject to severe civil, criminal and 
administrative penalties."

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to