[CMake] cmake

Rolf Eike Beer eike at sf-mail.de
Sun Jun 24 07:34:02 EDT 2012


> project( ptedit_1 )
> CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
> find_package( KDE4 REQUIRED )
> SET( MAIN_PROJECT_NAME ${PROJECT_NAME})
> INCLUDE_DIRECTORIES( ${KDE4_INCLUDES}  )
> SET(CPACK_SET_DESTDIR "ON")
> set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
> include_directories( ${KDE4_INCLUDE_DIRS} ${libkdepim_INCLUDES})
> add_definitions( ${KDE4_DEFINITIONS} )
> set( SOURCES src/ptedit_1.cpp )
> kde4_add_ui_files( ptedit_1 ${CMAKE_SOURCE_DIR} ptedit_1.ui )
> kde4_add_executable( ptedit_1 ${ptedit_1Sources}  ${CMAKE_SOURCE_DIR})
> target_link_libraries( ptedit_1 ${KDE4_KDEUI_LIBS} )
> install(TARGETS ptedit_1 ${INSTALL_TARGETS_DEFAULT_ARGS})
>
>
> I am getting error-CMake Error: CMake can not determine linker language
> for target:ptedit_1
> CMake Error: Cannot determine link language for target "ptedit_1".
> Please suggest what should I modify in this file and how? I tried hard but
> unable to find what is wrong please help--

You are adding an executable without files, so CMake can't determine which
language (C or C++) to use. You do

> set( SOURCES src/ptedit_1.cpp )

but then

> kde4_add_executable( ptedit_1 ${ptedit_1Sources}  ${CMAKE_SOURCE_DIR})

Adding the source dir there is totally wrong, and ptedit_1Sources has
never been set before.

Since I see you struggle with this stuff for some days: put message(STATUS
"${myvar}") at different places in your CMakeLists.txt to see the contents
of the variables. Check if they make any sense. Hint: myvar is again a
placeholder.

Take a working project (KDE has many of them) and modify the
CMakeLists.txt to fit your need, i.e. replace the values of the variables
with your files.

Eike


More information about the CMake mailing list