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

Jason Harris kstars at 30doradus.org
Sun Jul 16 20:04:20 CEST 2006


Hi,

AFAIK, it's not necessary to install these header files, since no other 
code needs to use them.

The include path is defined in the parent directory's CMakeLists.txt.  I 
don't think the includes are the problem; IIUC, "undefined reference" 
errors at the linker stage indicate a missing *.so library, not a 
missing header.

thanks,
Jason

Joseph Kerian wrote:
> 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 )
>> install(TARGETS SatLib  DESTINATION ${LIB_INSTALL_DIR} )
> 
> 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
> ${INCLUDE_INSTALL_DIR}/satlib )
> 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).
> 
> --Joe
> _______________________________________________
> kde-edu mailing list
> kde-edu at mail.kde.org
> https://mail.kde.org/mailman/listinfo/kde-edu
> 
> 



More information about the kde-edu mailing list