1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-04 06:15:24 +00:00
freebsd-ports/databases/soci/files/patch-cmake_modules_FindMySQL.cmake
Adriaan de Groot 70cf3cded5 Pre-emptively fix databases/soci for CMake 3.11.
With CMake 3.11, configure fails with this error:

  CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
  Please set them or make sure they are set and tested correctly in the CMake files:
  MYSQL_EMBEDDED_LIBRARIES
      linked by target "cmTC_ec547" in directory /wrkdirs/usr/ports/databases/soci/work/soci-3.2.2/CMakeFiles/CMakeTmp

  CMake Error at /usr/local/share/cmake/Modules/CheckIncludeFile.cmake:60 (try_compile):
    Failed to configure test project build system.
  Call Stack (most recent call first):
    /usr/local/share/cmake/Modules/FindThreads.cmake:121 (CHECK_INCLUDE_FILE)
    core/CMakeLists.txt:17 (include)

The underlying issue is that the test for MySQL embedded leaks the
library into CMAKE_REQUIRED_LIBRARIES, which are then picked up in
other feature tests. If the library wasn't found (which is normal,
it's not a dependency in the port) then those later tests fail.
CMake 3.11 is somehow stricter about this than CMake 3.10.

No PORTREVISION bump because it's a pre-emptive build fix and nothing
changes on the port.

Approved by:	tcberner (mentor, implicit)
2018-04-08 12:33:01 +00:00

15 lines
690 B
CMake

Prevent CMAKE_REQUIRED_LIBRARIES from leaking out of this module.
If the embedded libs are not found, we don't want to have the
not-found libraries required by other modules.
--- cmake/modules/FindMySQL.cmake.orig 2013-08-21 22:40:11 UTC
+++ cmake/modules/FindMySQL.cmake
@@ -119,6 +119,7 @@ endif(MYSQL_EMBEDDED_LIBRARIES)
set( CMAKE_REQUIRED_INCLUDES ${MYSQL_INCLUDE_DIR} )
set( CMAKE_REQUIRED_LIBRARIES ${MYSQL_EMBEDDED_LIBRARIES} )
check_cxx_source_compiles( "#include <mysql.h>\nint main() { int i = MYSQL_OPT_USE_EMBEDDED_CONNECTION; }" HAVE_MYSQL_OPT_EMBEDDED_CONNECTION )
+unset( CMAKE_REQUIRED_LIBRARIES )
if(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
set(MYSQL_FOUND TRUE)