[cmake-developers] [CMake 0012322]: Ability to add source files to target created with ExternalProject

Mantis Bug Tracker mantis at public.kitware.com
Fri Jul 8 05:27:14 EDT 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12322 
====================================================================== 
Reported By:                Yuri
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12322
Category:                   CMake
Reproducibility:            always
Severity:                   tweak
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-07-08 05:27 EDT
Last Modified:              2011-07-08 05:27 EDT
====================================================================== 
Summary:                    Ability to add source files to target created with
ExternalProject
Description: 
In my scenario I have part of project which should be built with different
toolset (Main project is built with VC2010, and some legacy libraries with VC6
and VS2005).
Basically nested project contains
set(Proj_SRCS src1.cpp src2.cpp...)
add_library(Proj MODULE ${Proj_SRCS})

So set() command may be moved into separate file which in turn could be included
into main project. So I want to see them there to edit in IDE, but not compile.

The only possibility to add files to custom target - is specify SOURCES in
add_custom_target command (It's impossible to call cmTarget::AddSources from
outside). However, ExternalProject_Add macro doesn't add any sources.

Moreover, there is a kind of chicken-and-egg problem: all arguments are parsed
and set as property on target. But you can't set property while there is no
target.

So as quick work-around I made private copy of ExternalProject.cmake and pass
sources as directory property.

So I'm asking for ideas how to properly implement this feature: modify somehow
parameters parsing in ExternalProject, or may be introduce command which allows
adding new sources to existing targets (I'm not sure if this will work, but for
me it sounds like target_link_libraries command).
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-07-08 05:27 Yuri           New Issue                                    
======================================================================




More information about the cmake-developers mailing list