sorry to be such a newb, but I'm building a mySQL driver from source, and it needs to include mysql.h, but the compiler reports an error. The includes in FindMYSQL.cmake seem ok, so I'm guessing that CMake is missing the most basic pointer from its CMake Settings. I've tried a couple of paths in the json but no luck - I don't really know what I'm trying to point it to? I'm struggling to come to terms with c++ at the moment, so any assistance appreciated.
CMake Error at cmake/FindMySQL.cmake:548 (message):
Could not find "mysql.h" from searching "/usr/include/mysql
/usr/local/include/mysql /opt/mysql/mysql/include
/opt/mysql/mysql/include/mysql /usr/local/mysql/include
/usr/local/mysql/include/mysql C:\Program Files (x86)/MySQL/*/include
C:/MySQL/*/include" C:\Users\Studio\Source\Repos\mysql-connector-odbc\cmake/FindMySQL.cmake 548
Line 548 is the fatal error message, source here:
# No specific paths, try some common install paths
find_path(MYSQL_INCLUDE_DIR mysql.h ${_include_fallback_path})
if(NOT MYSQL_INCLUDE_DIR)
message(FATAL_ERROR "Could not find \"mysql.h\" from searching "
"\"${_pp_include_fallback_path}\"")
endif()
If I peek at MYSQL_INCLUDE_DIR: Line 512 in FindMySQL.cmake
set(MYSQL_INCLUDE_DIR "${MYSQL_DIR}/include/mysql-8.0")
if(NOT EXISTS "${MYSQL_INCLUDE_DIR}/include/mysql-8.0/mysql.h")
message(FATAL_ERROR "MYSQL_DIR given, but no \"mysql.h\" "
"in \"${MYSQL_INCLUDE_DIR}\"")
endif()
I was able to recreate the problem and fix it by installing MySQL Server, which added the missing include paths and environmental arguments. However, to fix this problem specifically:
Remove the “/mysql-8.0“ from your defined path.
Call CMake with the following -D option:
cmake -DMYSQL_INCLUDE_DIR=‘C:\Program Files\MySql\mysql server 8.0\include‘
The -D command line option defines a CMake constant with a given value if needed.