DevHeads.net

KF5_ADD_KDEINIT_EXECUTABLE linker errors

Trying to port cervisia to KF5, I struggle with above.

Having
kf5_add_kdeinit_executable(cvsaskpass cvsaskpass.cpp)

always gives linker errors:
CMakeFiles/cvsaskpass.dir/cvsaskpass_dummy.cpp.o: In function `kdeinitmain':
cvsaskpass_dummy.cpp:(.text+0x1c): undefined reference to `kdemain'
CMakeFiles/cvsaskpass.dir/cvsaskpass_dummy.cpp.o: In function `main':
cvsaskpass_dummy.cpp:(.text+0x3e): undefined reference to `kdemain'

checking the cmake macro in /usr/lib64/cmake/KF5Init/KF5InitMacros.cmake, I wonder why
is this even there:
add_executable(${_target_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${_target_NAME}_dummy.cpp ${_resourcefile})

and if it's needed, then why does it not add ${_SRCS} directly, since by default
the visbility of symbols is set to hidden, so this
target_link_libraries(${_target_NAME} kdeinit_${_target_NAME})
can't work.
cvsaskpass.cpp contains:
extern "C" int kdemain(int argc, char** argv)...

What am I missing ?

Comments

Re: KF5_ADD_KDEINIT_EXECUTABLE linker errors

By David Faure at 01/02/2016 - 11:51

On Friday 01 January 2016 15:45:45 Martin Koller wrote:
Q_DECL_EXPORT before int kdemain.