[CMake] Visual Studio 2008 configure and build step independency

2011-09-22 Thread Thomas Wolf
Hello all,

i think i stumbled upon something that keeps me occupied for quite some
time now:

I have a quite large CMake based project, wich is intended to generate a
Visual Studo 2008 solution. The problem is, that I use mixed internal
and external projects, which depend on each other, like VTK, ITK, CTK
and a main project which uses them. This is partly intended, because
including the projects (with add_subdirectory) guarantees that the
source files and headers show up in the final Visual Studio solution.

CTK for example is an external project, and the main project always
fails to get the configuration of the CTK project (usefile, configfile).

This is why:

During generation, the main project does a find_packag(CTK). As there is
no find module for this, the method then works in config mode.

Now things get a little awkward:

The main project does the request with findpackage during its config and
generation time, whereas the external projects like CTK, Log4Qt etc.
generate such things only when the projects's solution file is loaded
into Visual Stuido and is beeing built!

But of course, generation failed due to the missing external projects
configs...

Does anyone have some ideas or a solution to this problem?

The problem s apparently that build time in visual Studio is separated
from the configuration. Is there a way how to force a exterbal project
into the configuration step *without* buildng afterwards, like a custom
CONFIGURE_COMMAND that triggers cmake itself? The subprojects are pure
CMakeprojects, after all...

Help is highly appreciated!

Regards,
Thomas
--

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


Re: [CMake] Visual Studio 2008 configure and build step independency

2011-09-22 Thread Bill Hoffman

On 9/22/2011 1:07 PM, Thomas Wolf wrote:

Addition:

if i try to fake the contents of the CTK use file, like

set_found true
usefile_included 1

find_package still tries to include the CTKConfig.cmake. I always thougt
if the Find-variable is set to true find_package just assumes that
everything went fine and continues (silent mode). Or is this only the
module mode of find_package?

This is a limitation of external_project.  For external_project to work 
all of the toplevel projects must also be external_projects.  There is 
not an easy cross platform way to have external_project targets be used 
by non-external targets.  This is not supported:


add_external_project(foo ..) # creates a library foo
find_package(foo) # find the library created by the external project foo
add_executable(bar ..)
target_link_libraries(bar foo)

It has to be like this:

add_external_project(foo ...)
add_external_project(bar ...)  # inside here it does a find_package(foo)

external project defers configuration and of course build until build 
time.  find_package, find_library expect to find an already built 
package.


http://www.kitware.com/products/html/BuildingExternalProjectsWithCMake2.8.html

-Bill


--

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