0

How could I fix this problem? All packages I installed: libmysqlclient-dev, mysql-server, mysql-client. After installation all that packages everything supposed to work, but it does not

cmake_minimum_required(VERSION 3.15)

project(Application)

set(CMAKE_EXE_LINKER_FLAGS "-export-dynamic")
set (APP_VERSION_MAJOR 1)
set (APP_VERSION_MINOR 0)
set (APP_TARGET main)
set (CMAKE_CXX_STANDARD 20)

set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/adm/cmake" ${CMAKE_MODULE_PATH})

find_package (PkgConfig REQUIRED)
pkg_check_modules(mysqlclient)
          
foreach(FLAG ${LIBMYSQLCLIENT_CFLAGS_OTHER})
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}")
endforeach()

link_directories(${LIBMYSQLCLIENT_LIBRARY_DIRS})  
                              
add_executable(${APP_TARGET}
              main.cxx
              LoginWindow.cxx
              AdminWindow.cxx
              MainWindow.cxx
              InFolderWindow.cxx
              ViewportWindow.cxx
              OcctGtkViewer.cxx
              ViewerInteractor.cxx
              CustomCursor.cxx
              )

target_link_libraries(main PUBLIC ${LIBMYSQLCLIENT_LIBRARIES})
target_link_libraries(main PUBLIC mysqlcppconn)
XoDefender
  • 33
  • 6
  • 2
    Detail the "not working" by editing the question with sufficient detail to avoid guesswork as to the cause of the problem. Exact error messages (as formatted text) are ideal. – danblack Sep 06 '22 at 07:03
  • None of the required 'mysqlclient' found – XoDefender Sep 06 '22 at 07:06
  • I had an advice to include this pkg_check_modules in my cmake but I do not know how it could help. I am pretty new to cmake – XoDefender Sep 06 '22 at 07:07
  • It seems you forgot the first parameter to `pkg_check_modules` which means prefix to names of the variables created by that call: `pkg_check_modules(LIBMYSQLCLIENT mysqlclient)`. But make sure to check other answers from the [duplicate question](https://stackoverflow.com/questions/29191855/what-is-the-proper-way-to-use-pkg-config-from-cmake): they provide a lot of useful information for one who "pretty new to cmake". – Tsyvarev Sep 06 '22 at 09:20

0 Answers0