Michele Calgaro wrote: > On 2016/05/02 05:08 AM, deloptes wrote: >> Michele Calgaro wrote: >> >>>> Ah, thanks, this is exactly what I was looking for. It has been a >>>> couple of years since I last created CMakeList.txt . I think I would >>>> need a refresh of this part of my memory - it wasn't thaaaat hard as >>>> the automake stuff. >>> >>> Copy one from another folder (example from vcard or vcardfolder) and >>> modify from there. Easier way to learn something ;-) >>> >>>> >>>> New query: >>>> 1. Is there a good way to convert the Makefile.am into CMakeList.txt? >>>> 2. Is there an alternative way to test the library with the function of >>>> interest without installing it? >>>> >>> You can create a small test program with your test code, compile and >>> execute. That should be reasonably quick. No need to set any special >>> linking folder, if you have everything installed correctly if should >>> just find the right function in the right library file by itself. That >>> is how I tested that regex code in VCardTool >>> >>> Cheers >>> Michele >> >> I created usable CMakeList.txt to compile tests in tdeabc. This I did by >> extending the present CMakeList.txt file with some information from the >> Makefile.am. This is almost working. The problem I face is this >> >> [ 71%] Building CXX object >> tdeabc/tests/CMakeFiles/testldapclient.dir/testldapclient.cpp.o >> /opt/software/KDE/TDE/tdelibs-trinity-14.0.3/tdeabc/tests/testldapclient.cpp:161:30: >> fatal error: testldapclient.moc: No such file or directory >> #include "testldapclient.moc" >> ^ >> Can you advise how one could tell CMake to create (and use) >> testldapclient.moc ? >> >> Next thing to do is to make possible compiling the tests for vcardparser. >> >> thanks in advance >> >> regards >> >> > Hi Emanoil,can you share the cmakelist file you created? i will try to > take a look at this later during the second part of week. > Cheers > Michele Thanks Michele! If you can also check also following (the list of issues I had): - bigread and bigwrite crash with double link error - testdb does not compile (see TODO) - testldapclient.moc not generated thank you in advance and regards
# # Make sure $(all_includes) remains last! include_directories( ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/tdecore ${CMAKE_SOURCE_DIR}/tdeabc ${CMAKE_BINARY_DIR}/tdeabc ${CMAKE_SOURCE_DIR}/tdeui ${CMAKE_BINARY_DIR}/tdeui ${CMAKE_BINARY_DIR}/tdecore ${CMAKE_SOURCE_DIR}/kab ${CMAKE_SOURCE_DIR}/dcop ${CMAKE_SOURCE_DIR}/tdeio ${CMAKE_SOURCE_DIR}/tdeio/tdeio ${CMAKE_SOURCE_DIR}/tdeabc/vcard/include ${CMAKE_SOURCE_DIR}/tdeabc/vcard/include/generated ${CMAKE_SOURCE_DIR}/tdeabc/vcardparser ${CMAKE_SOURCE_DIR}/tdeabc/plugins ${CMAKE_SOURCE_DIR}/tdeabc/plugins/sql ) link_directories( ${TQT_LIBRARY_DIRS} ${CMAKE_SOURCE_DIR}/ ${CMAKE_SOURCE_DIR}/tdeabc ) # LDADD = ../libtdeabc.la # # METASOURCES = AUTO # check_PROGRAMS = testlock testldapclient set( target testlock ) add_executable(${target} testlock.cpp) target_link_libraries(${target} ${CMAKE_BINARY_DIR}/tdeabc/libtdeabc.so ${CMAKE_BINARY_DIR}/tdecore/libtdecore.so ${CMAKE_BINARY_DIR}/tdeabc/plugins/file/libtdeabc_file.so ${CMAKE_BINARY_DIR}/tdefx/libtdefx.so ${CMAKE_BINARY_DIR}/tdeui/libtdeui.so # ${CMAKE_BINARY_DIR}/tdeio/tdeio/libtdeiocore.a tqt-mt tqt ${CMAKE_BINARY_DIR}/dcop/libDCOP.so ) # set( target testldapclient ) # # # EXTRA_PROGRAMS = testkabc testkabcdlg testdistlist bigread bigwrite testdb \ # # testaddressee testaddresseelist testaddressfmt tdeabcargl testaddresslineedit # # set( ${target}_SRCS # testldapclient.cpp # # testldapclient_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor # # LINK kab-static tdeabc-shared # ) add_executable(testldapclient testldapclient.cpp) target_link_libraries(testldapclient ${CMAKE_BINARY_DIR}/tdeabc/libtdeabc.so ${CMAKE_BINARY_DIR}/tdecore/libtdecore.so ${CMAKE_BINARY_DIR}/tdeabc/plugins/file/libtdeabc_file.so ${CMAKE_BINARY_DIR}/tdefx/libtdefx.so ${CMAKE_BINARY_DIR}/tdeui/libtdeui.so # ${CMAKE_BINARY_DIR}/tdeio/tdeio/libtdeiocore.a tqt-mt tqt ${CMAKE_BINARY_DIR}/dcop/libDCOP.so ) # tde_add_executable( ${target} # SOURCES ${${target}_SRCS} # LINK kab-static tdeabc-shared # DESTINATION ${BIN_INSTALL_DIR} # ) # tde_add_library( ${target} STATIC_PIC # SOURCES ${${target}_SRCS} # ) # set( target testtdeabc ) # # set( ${target}_SRCS # # # testtdeabc_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor # ) add_executable(testtdeabc testkabc.cpp) target_link_libraries(testtdeabc ${CMAKE_BINARY_DIR}/tdeabc/libtdeabc.so ${CMAKE_BINARY_DIR}/tdecore/libtdecore.so ${CMAKE_BINARY_DIR}/tdeabc/plugins/file/libtdeabc_file.so ${CMAKE_BINARY_DIR}/tdefx/libtdefx.so ${CMAKE_BINARY_DIR}/tdeui/libtdeui.so # ${CMAKE_BINARY_DIR}/tdeio/tdeio/libtdeiocore.a tqt-mt tqt ${CMAKE_BINARY_DIR}/dcop/libDCOP.so ) # set( target testaddressee ) # # set( ${target}_SRCS # testaddressee.cpp # # testaddressee_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor # ) add_executable(testaddressee testaddressee.cpp) target_link_libraries(testaddressee ${CMAKE_BINARY_DIR}/tdeabc/libtdeabc.so ${CMAKE_BINARY_DIR}/tdecore/libtdecore.so ${CMAKE_BINARY_DIR}/tdeabc/plugins/file/libtdeabc_file.so ${CMAKE_BINARY_DIR}/tdefx/libtdefx.so ${CMAKE_BINARY_DIR}/tdeui/libtdeui.so # ${CMAKE_BINARY_DIR}/tdeio/tdeio/libtdeiocore.a tqt-mt tqt ${CMAKE_BINARY_DIR}/dcop/libDCOP.so ) # set( target testaddresseelist ) # # set( ${target}_SRCS # testaddresseelist.cpp # # testaddresseelist_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor # ) add_executable(testaddresseelist testaddresseelist.cpp) target_link_libraries(testaddresseelist ${CMAKE_BINARY_DIR}/tdeabc/libtdeabc.so ${CMAKE_BINARY_DIR}/tdecore/libtdecore.so ${CMAKE_BINARY_DIR}/tdeabc/plugins/file/libtdeabc_file.so ${CMAKE_BINARY_DIR}/tdefx/libtdefx.so ${CMAKE_BINARY_DIR}/tdeui/libtdeui.so # ${CMAKE_BINARY_DIR}/tdeio/tdeio/libtdeiocore.a tqt-mt tqt ${CMAKE_BINARY_DIR}/dcop/libDCOP.so ) # set( target testaddressfmt ) # # set( ${target}_SRCS # testaddressfmt.cpp # # testaddressfmt_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor # ) add_executable(testaddressfmt testaddressfmt.cpp) target_link_libraries(testaddressfmt ${CMAKE_BINARY_DIR}/tdeabc/libtdeabc.so ${CMAKE_BINARY_DIR}/tdecore/libtdecore.so ${CMAKE_BINARY_DIR}/tdeabc/plugins/file/libtdeabc_file.so ${CMAKE_BINARY_DIR}/tdefx/libtdefx.so ${CMAKE_BINARY_DIR}/tdeui/libtdeui.so # ${CMAKE_BINARY_DIR}/tdeio/tdeio/libtdeiocore.a tqt-mt tqt ${CMAKE_BINARY_DIR}/dcop/libDCOP.so ) # set( target testkabcdlg ) # set( ${target}_SRCS testkabcdlg.cpp # # testkabcdlg_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor # ) add_executable(testkabcdlg testkabcdlg.cpp) target_link_libraries(testkabcdlg ${CMAKE_BINARY_DIR}/tdeabc/libtdeabc.so ${CMAKE_BINARY_DIR}/tdecore/libtdecore.so ${CMAKE_BINARY_DIR}/tdeabc/plugins/file/libtdeabc_file.so ${CMAKE_BINARY_DIR}/tdefx/libtdefx.so ${CMAKE_BINARY_DIR}/tdeui/libtdeui.so tqt-mt tqt ${CMAKE_BINARY_DIR}/dcop/libDCOP.so ) # set( target testdistlist ) # set( ${target}_SRCS testdistlist.cpp # # testdistlist_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor # ) add_executable( testdistlist testdistlist.cpp) target_link_libraries(testdistlist ${CMAKE_BINARY_DIR}/tdeabc/libtdeabc.so ${CMAKE_BINARY_DIR}/tdecore/libtdecore.so ${CMAKE_BINARY_DIR}/tdeabc/plugins/file/libtdeabc_file.so ${CMAKE_BINARY_DIR}/tdefx/libtdefx.so ${CMAKE_BINARY_DIR}/tdeui/libtdeui.so tqt-mt tqt ${CMAKE_BINARY_DIR}/dcop/libDCOP.so ) # set( target testaddresslineedit ) # set( ${target}_SRCS testaddresslineedit.cpp # # testaddresslineedit_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor # ) add_executable( testaddresslineedit testaddresslineedit.cpp) target_link_libraries(testaddresslineedit ${CMAKE_BINARY_DIR}/tdeabc/libtdeabc.so ${CMAKE_BINARY_DIR}/tdecore/libtdecore.so ${CMAKE_BINARY_DIR}/tdeabc/plugins/file/libtdeabc_file.so ${CMAKE_BINARY_DIR}/tdefx/libtdefx.so ${CMAKE_BINARY_DIR}/tdeui/libtdeui.so tqt-mt tqt ${CMAKE_BINARY_DIR}/dcop/libDCOP.so ) # set( target bigread ) # # set( ${target}_SRCS bigread.cpp # # bigread_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor # # bigread_LDADD = ../libtdeabc.la $(top_builddir)/tdeabc/plugins/file/libtdeabc_file.la # ) add_executable( bigread bigread.cpp) target_link_libraries(bigread ${CMAKE_BINARY_DIR}/tdeabc/libtdeabc.so ${CMAKE_BINARY_DIR}/tdecore/libtdecore.so ${CMAKE_BINARY_DIR}/tdeabc/plugins/file/libtdeabc_file.so ${CMAKE_BINARY_DIR}/tdefx/libtdefx.so ${CMAKE_BINARY_DIR}/tdeui/libtdeui.so tqt-mt ${CMAKE_BINARY_DIR}/dcop/libDCOP.so ) # DCOP tdefx # set( target bigwrite ) # # set( ${target}_SRCS bigwrite.cpp # # bigwrite_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor # # bigwrite_LDADD = ../libtdeabc.la $(top_builddir)/tdeabc/plugins/file/libtdeabc_file.la # ) add_executable(bigwrite bigwrite.cpp) target_link_libraries(bigwrite ${CMAKE_BINARY_DIR}/tdeabc/libtdeabc.so ${CMAKE_BINARY_DIR}/tdecore/libtdecore.so ${CMAKE_BINARY_DIR}/tdeabc/plugins/file/libtdeabc_file.so ${CMAKE_BINARY_DIR}/tdefx/libtdefx.so ${CMAKE_BINARY_DIR}/tdeui/libtdeui.so # ${CMAKE_BINARY_DIR}/tdeio/tdeio/libtdeiocore.a tqt-mt tqt ${CMAKE_BINARY_DIR}/dcop/libDCOP.so ) # # TODO: skip for now - it looks like sql lib is not being produces to link against # # add_executable(testdb testdb.cpp) # target_link_libraries(testdb # ${CMAKE_BINARY_DIR}/tdeabc/libtdeabc.so # ${CMAKE_BINARY_DIR}/tdecore/libtdecore.so # ${CMAKE_BINARY_DIR}/tdeabc/plugins/file/libtdeabc_file.so # ${CMAKE_BINARY_DIR}/tdefx/libtdefx.so # ${CMAKE_BINARY_DIR}/tdeui/libtdeui.so # # ${CMAKE_BINARY_DIR}/tdeio/tdeio/libtdeiocore.a # tqt-mt # tqt # ${CMAKE_BINARY_DIR}/dcop/libDCOP.so # ) # set( target tdeabcargl ) # # set( ${target}_SRCS tdeabcargl.cpp # # tdeabcargl_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor # ) add_executable(tdeabcargl kabcargl.cpp) target_link_libraries(tdeabcargl ${CMAKE_BINARY_DIR}/tdeabc/libtdeabc.so ${CMAKE_BINARY_DIR}/tdecore/libtdecore.so ${CMAKE_BINARY_DIR}/tdeabc/plugins/file/libtdeabc_file.so ${CMAKE_BINARY_DIR}/tdefx/libtdefx.so ${CMAKE_BINARY_DIR}/tdeui/libtdeui.so # ${CMAKE_BINARY_DIR}/tdeio/tdeio/libtdeiocore.a tqt-mt tqt ${CMAKE_BINARY_DIR}/dcop/libDCOP.so )