You haven't posted anything that anyone can help with. All I can say is try to use 'cmake' to build a simple "hello world" then repeat with it building a library and/or referencing one. Here's the simplest "complete" example I can quickly locate. Unfortunately I don't have time to modify it down to a really simple example..It builds 'sdldd' (APP) which requires libsd.a (SDLIB) to be built which itself requires an existing mariadb installation (MYSQL). Ignore the "*.cci" stuff. Always build "out of tree" and note cmake has a habit of remembering stuff so you're best off deleting the build folder each time before re-running cmake until such time the build works.
Sorry I don't have time to elaborate. Image may be NSFW.
Clik here to view.
Code:
foo@sdu:~/usr/src/QTP$ less sdldd/CMakeLists.txtcmake_minimum_required(VERSION 2.8.12)set(APP sdldd)project (${APP})##------------------------------------------------------------------------------set(CMAKE_VERBOSE_MAKEFILE ON)#set(CMAKE_CXX_FLAGS "-O0 -g -ansi -pedantic -W -Wall -Werror")set(CMAKE_CXX_FLAGS "-std=c++11 -O0 -g -pedantic -Wno-long-long -W -Wall")##------------------------------------------------------------------------------set(MYSQL /usr/local/mysql)set(MYSQL_H "${MYSQL}/include/mysql")set(MYSQL_L "${MYSQL}/lib")set(SDLIB sd)file(GLOB SDLIB_S "${SDLIB}/cpp/*.cpp")file(GLOB SDLIB_H "${SDLIB}/hpp/*.hpp")file(GLOB SDLIB_C "${SDLIB}/cci/*.cci")add_library(${SDLIB} STATIC ${SDLIB_S} ${SDLIB_H} ${SDLIB_C})target_include_directories(${SDLIB} PUBLIC ${SDLIB}/hpp ${SDLIB}/cci ${MYSQL_H})target_compile_options(${SDLIB} PUBLIC -DDEBUG -DSD_LIB)##------------------------------------------------------------------------------file(GLOB APP_S "${APP}/cpp/*.cpp")file(GLOB APP_H "${APP}/hpp/*.hpp")file(GLOB ETC "${APP}/etc/*")add_executable(${APP} ${APP_S} ${APP_H})include_directories(${APP}/hpp ${SDLIB})target_link_libraries(${APP} ${SDLIB} ${MYSQL_L}/libmysqlclient.a gnutls z pthread dl rt)##------------------------------------------------------------------------------install(TARGETS ${APP} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
Sorry I don't have time to elaborate. Image may be NSFW.
Clik here to view.

Statistics: Posted by swampdog — Wed May 22, 2024 9:41 pm