[CMake] CMake and Clanlib

Alexander Neundorf a.neundorf-work at gmx.net
Sun May 11 12:08:37 EDT 2008


On Sunday 11 May 2008, Nathan Huesken wrote:
> Hi,
>
> I am completly new to cmake, I want to use it in a project, where I also
> use ClanLib. What I did:
> I downloaded http://www.cmake.org/Wiki/CMakeUserFindClanLib into
> ClanLibConfig.cmake
>
> This is my CMakeLists.txt:
> SET(sources main.cc)
> SET(ClanLib_DIR /home/ls/Project/)
> FIND_PACKAGE(ClanLib)
> INCLUDE_DIRECTORIES(${ClanLib_INCLUDE_DIR})
> ADD_EXECUTABLE(schueler ${sources})
> TARGET_LINK_LIBRARIES(schueler ${ClanLib_LIBRARY})
>
> The line SET(ClanLib_DIR /home/ls/Project/) sets ClanLib_DIR to the
> directory of ClanLibConfig.cmake. Unfortantly this setup does not find the
> ClanLib library.
> My questions:
>
> 1. What am I doing wrong?

Does it print out anything ?
Can you post this ?

> 2. How can I set ClanLib_DIR to the current directory? "." does not work

You can use ${CMAKE_CURRENT_SOURCE_DIR} for the current directory.

> 3. How can I make CMake stop with an error if it does not find ClanLib?

find_package(ClanLib REQUIRED)

If it doesn't stop then, it's a bug in CMakeUserFindClanLib

Alex


More information about the CMake mailing list