It's where mysqlclient.so located
[dbn@hecs-137331 mysql]$ pwd
/usr/lib64/mysql
[dbn@hecs-137331 mysql]$ ls
INFO_BIN libmysqlclient.so libmysqlclient.so.21 plugin
INFO_SRC libmysqlClient.so libmysqlclient.so.21.1.26
And this is how my CMakeLists.txt include the lib
target_include_directories(main PUBLIC "usr/lib64/mysql")
include_directories("usr/lib64/mysql")
target_link_libraries(main mysqlclient)
This is the error message
[dbn@hecs-137331 build]$ make
[ 14%] Built target zlog
[ 23%] Built target buffer
[ 47%] Built target http
[ 61%] Built target pool
[ 80%] Built target server
[ 90%] Built target timer
[ 95%] Linking CXX executable bin/main
/usr/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/main.dir/build.make:109: bin/main] Error 1
make[1]: *** [CMakeFiles/Makefile2:213: CMakeFiles/main.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
I just install mysql by 'sudo yum install mysql' so There is no file named 'mysqlConfig.cmake' and i dont use find_package
Currently,
link_directories("usr/lib64/mysql")
target_link_libraries(main mysqlclient)
link_directories("usr/lib64/mysql")
all of above cannot find the libmysqlclient.so and show the message /usr/bin/ld: cannot find -lmysqlclient
And I also Tried to copy the lib to the /usr/bin
dirctory. It doesn't work too.