I searched the entire network, basically no one to write clion import mysql library under windows, own fiddle for a long time, we can save some efforts now
Directly attached to the code
cmake_minimum_required (VERSION 3.7 ) Project (Clion_mysql) the SET (CMAKE_CXX_STANDARD 11 ) the SET (SOURCE_FILES main.cpp) # above basic unimportant # declaration header file path to the SET (INC_DIR C: \\ Program \ Files \\ \\ MySQL MySQL \ Server \ 8.0 \\ the include) # link library path statement the SET (LINK_DIR C: \\ Program \ files \\ \\ MySQL MySQL \ Server \ 8.0 \\ lib) # introduction header file include_directories ($ INC_DIR {}) # import library file link_directories ($ {} LINK_DIR) link_libraries (for libmysql) add_executable (Clion_mysql SOURCE_FILES $ {}) target_link_libraries (Clion_mysql for libmysql)