[CMake] TARGET_SUPPORTS_SHARED_LIBS not set
Eric Noulard
eric.noulard at gmail.com
Tue Sep 11 13:33:40 EDT 2012
2012/9/11 Nico Schlömer <nico.schloemer at gmail.com>:
> 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
More information about the CMake
mailing list