2012/9/11 Nico Schlömer <[email protected]>:
> Indeed, that gets set up by the PROJECT() call.
>
> Now, this creates a little bit of a problem here.
> The main CMakeLists.txt looks something like
>
> =============== *snip* ===============
> CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
>
> FIND_PACKAGE(Foobar REQUIRED)
>
> # Set compilers before the PROJECT is declared.
> SET(CMAKE_CXX_COMPILER ${Foobar_CXX_COMPILER})
>
> PROJECT(MyProject CXX)
> [...]
> =============== *snap* ===============
>
> Evidently, FIND_PACKAGE() must be called before PROJECT(),
> specifically before TARGET_SUPPORTS_SHARED_LIBS is set.

Nope I think your usage is not supported.
Compiler is not supposed to be set y a call to find_package.

Compiler may be define:
  - By CMake discovery during project(...) command processing
  - By a [cross-compiling] toolchain file provided on the command line
    (or to cmake-gui)
  - By CMakeForceCompiler module
    see cmake --help-module CMakeForceCompiler

> However, the Foobar package not only defines some compiler variables,
> but also includes libraries like
>
> ADD_LIBRARY(barfoo SHARED IMPORTED)
>
> Those ADD_LIBRARY(... SHARED ...) calls however check for
> TARGET_SUPPORTS_SHARED_LIBS and choke if it is not defined.
>
> What could be identified as the bug here?

Defining compiler inside find package.
How did you get the "FindFoobar.cmake"  file?

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org
--

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