Bug #64908 Build out-of-source fails
Submitted: 8 Apr 2012 5:58 Modified: 12 Feb 2013 23:48
Reporter: watson song Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / C Severity:S2 (Serious)
Version:6.0.2 OS:Any (Mac OS X 10.6.8, Linux)
Assigned to: CPU Architecture:Any
Tags: compile;macos;cmake, Contribution

[8 Apr 2012 5:58] watson song
Description:
I use mac os x to build the libmysql from source code, and I remove the cpack part from CMakeLists.txt for it can not find files like README.
And then I generate makefile by using command: 
cmake -G"Unix Makefiles" .
make

And the output I will attach in additional file.

How to repeat:
1. Decompress mysql-connector-c-6.0.2.tar.gz and modify the cpack part of CMakeLists.txt in the root like this:
# ----------------------------------------------------------------------
# Create package script
# ----------------------------------------------------------------------

IF(NOT CONNECTOR_PLATFORM)
  IF(WIN32)
    IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
      SET(CONNECTOR_PLATFORM "winx64") 
    ELSE(CMAKE_SIZEOF_VOID_P MATCHES 8)
      SET(CONNECTOR_PLATFORM "win32") 
    ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 8)
  ELSE(WIN32)
    SET(CONNECTOR_PLATFORM "unknown")
  ENDIF(WIN32)
ENDIF(NOT CONNECTOR_PLATFORM)

INCLUDE(InstallRequiredSystemLibraries)

SET(CPACK_PACKAGE_VERSION_MAJOR ${CONNECTOR_C_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${CONNECTOR_C_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${CONNECTOR_C_PATCH})

IF(NOT EXTRA_NAME_SUFFIX)
  SET(EXTRA_NAME_SUFFIX "")
ENDIF(NOT EXTRA_NAME_SUFFIX)

SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Connector/C (libmysql), a library for connecting to MySQL servers.")
SET(CPACK_PACKAGE_NAME                "mysql-connector-c${EXTRA_NAME_SUFFIX}")
SET(CPACK_PACKAGE_VENDOR              "Sun Microsystems, Inc.")
IF(EXISTS "${CMAKE_SOURCE_DIR}/COPYING")
  SET(CPACK_RESOURCE_FILE_LICENSE     "${CMAKE_SOURCE_DIR}/COPYING")
ELSE(EXISTS "${CMAKE_SOURCE_DIR}/COPYING")
  SET(CPACK_RESOURCE_FILE_LICENSE     "${CMAKE_SOURCE_DIR}/LICENSE.mysql")
ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/COPYING")
SET(CPACK_PACKAGE_DESCRIPTION_FILE    "${CMAKE_SOURCE_DIR}/README")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME    "${CPACK_PACKAGE_NAME}-${CONNECTOR_C_VERSION}")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY   "${CPACK_PACKAGE_NAME}-${CONNECTOR_C_VERSION}-${CONNECTOR_PLATFORM}")
IF(WIN32)
  SET(CPACK_GENERATOR                 "ZIP")
  SET(CPACK_PACKAGE_FILE_NAME         "${CPACK_PACKAGE_NAME}-noinstall-${CONNECTOR_C_VERSION}-${CONNECTOR_PLATFORM}")
ELSE(WIN32)
  SET(CPACK_GENERATOR                 "TGZ")
  SET(CPACK_PACKAGE_FILE_NAME         "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
ENDIF(WIN32)

INSTALL(FILES ${CPACK_RESOURCE_FILE_README} ${CPACK_RESOURCE_FILE_LICENSE}
    "${CMAKE_SOURCE_DIR}/EXCEPTIONS-CLIENT" "${CMAKE_SOURCE_DIR}/ChaneLog" DESTINATION "." OPTIONAL)

INCLUDE(CPack)

2. run command will cause error:
cmake -G"Unix Makefiles" .
make
[8 Apr 2012 6:03] watson song
The make error output

Attachment: report.txt (text/plain), 9.68 KiB.

[8 Apr 2012 6:04] watson song
The cmakelists.txt modify  the cpack

Attachment: CMakeLists.txt (text/plain), 14.45 KiB.

[21 Apr 2012 14:45] watson song
It seems libmysql can not build in other directory, I build it in the source directory is OK. I think if the mysql use cmake, it need support out source compile...
[25 Apr 2012 19:44] Sveta Smirnova
Thank you for the report.

Verified as described on Linux.
[8 May 2012 19:15] Sveta Smirnova
Bug #65231 was marked as duplicate of this one.

I also changed header of this report, so it would be easier to find.
[12 Feb 2013 23:47] Igor Solodovnikov
We cannot reproduce this problem. Tree builds fine in-source and out-of-source
on both Windows and Linux.