[CMake] Visual Studio 2008 configure and build step independency

Bill Hoffman bill.hoffman at kitware.com
Thu Sep 22 13:52:58 EDT 2011


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




More information about the CMake mailing list