[kde-edu]: : CMakeLists.txt for a library

Joseph Kerian jkerian at gmail.com
Sun Jul 16 19:16:55 CEST 2006

On 7/14/06, Jason Harris <kstars at 30doradus.org> wrote:
> Hello,
> I am trying to add a library written in C to KStars in order to track Earth
> satellites.  I'm having trouble getting the CMakeLists.txt file set up
> properly.  The library is very simple, there is only one source-code file
> and
> two header files.
> I have placed the files in a subdirectory, and here is my attempt at a
> CMakeLists.txt file:
> -------------------------
> ## SatLib Library ###
> set(SatLib_LIB_SRCS
>         ${CMAKE_SOURCE_DIR}/kstars/kstars/satlib/SatLib.c
> )
> kde4_add_library(SatLib SHARED ${SatLib_LIB_SRCS})
> target_link_libraries(SatLib m)
> set_target_properties(SatLib PROPERTIES VERSION 0.1.0 SOVERSION 1 )

I don't see you instructing cmake to build install targets for your
header files here. You probably need something like:
install( FILES header_file_A.h header_file_B.h DESTINATION
added to the CMakeLists.txt.
Your #include line will either have to take the satlib bit into
account, or you can use an explicit include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../satlib ) in the projects that need to
link to it (or something similar).


More information about the kde-edu mailing list