Nico Schlömer wrote:
> 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.
> 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?Fiddling with the compilers inside the CMakeLists.txt. Don't do it. Either use CC and CXX environment variables to set them up when calling CMake for the first time or use a toolchain file if you want to set up a cross compiler that needs some special arguments. But don't try changing the compilers from inside the CMakeLists.txt. As you already found out this is only a request for trouble which was promptly served. Eike --
signature.asc
Description: This is a digitally signed message part.
-- 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
