Bug #76968 Building from source using CMAKE_DEBUG_POSTFIX fails
Submitted: 7 May 2015 10:49 Modified: 19 May 2015 21:36
Reporter: Erik Schuitema Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / C Severity:S3 (Non-critical)
Version:6.1.6 OS:Windows (8.1)
Assigned to: Assigned Account CPU Architecture:Any
Tags: cmake

[7 May 2015 10:49] Erik Schuitema
Description:
When building from source while specifying a CMAKE_DEBUG_POSTFIX, the debug build fails while building 'mysqlclient[POSTFIX].lib' with the following error:
LINK : fatal error LNK1181: cannot open input file 'D:/path/to/mysql-connector-c-6.1.6-src/libmysql/Debug/clientlib.lib' [D:\path\to\mysql-connector-c-6.1.6-src\libmysql\mysqlclient.vcxproj]

Versions: CMake v.3.1.3; Visual Studio Express 2012.

How to repeat:
1.Download/unpack the 6.1.6 source code
2.Create a 'build' directory in the source dir
3.Configure:
  cmake -G "Visual Studio 11" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_DEBUG_POSTFIX=d -DCMAKE_INSTALL_PREFIX=.\build
4.Build:
  cmake --build . --target INSTALL --config Debug

Suggested fix:
The mysqlclient.lib is built using the MERGE_STATIC_LIBS macro from <source_dir>\cmake\libutils.cmake.
This macro fails to obtain the correct filename for libs when built with a CMAKE_DEBUG_POSTFIX.

The issue can be fixed, for example, by changing line 137:
      GET_TARGET_PROPERTY(LIB_LOCATION ${LIB} LOCATION)
to:
      GET_TARGET_PROPERTY(LIB_LOCATION ${LIB} LOCATION_${CMAKE_BUILD_TYPE})
[19 May 2015 21:36] Igor Solodovnikov
Verified as described with Windows 7 and cmake 2.8.12.2