-1

I am new to cmake and try to create a project that works with databases and need special flags to compile successfully. I need to find a way to tell cmake to use thoses flags but I did not find how to do it yet.

Compiling without cmake : g++ project.cpp -L /usr/include/mariadb/mysql -lmariadbclient -o project

cmake file:

#######################################################################

    *cmake_minimum_required(VERSION 3.23.1)
    project(IrcChannel)
    add_executable(${PROJECT_NAME} IrcChannel.cpp)
    add_subdirectory(Headers)
    target_include_directories(${PROJECT_NAME} PUBLIC Headers)
    target_link_directories(${PROJECT_NAME} PUBLIC Headers)
    target_link_libraries(${PROJECT_NAME} PUBLIC IrcChannelLibrary)*

#######################################################################

I have tried many things in vain, do you guys have any solution?

πάντα ῥεῖ
  • 85,314
  • 13
  • 111
  • 183
  • The `-L` flag denotes libraries search directory, the `-l` flag denotes linkage with the library. All these aspects in CMake are already covered by existed questions and answers. – Tsyvarev May 28 '22 at 15:31

0 Answers0