[CMake] Headers don't install on Mac OS X (mysql-connector-c)

Eric Noulard eric.noulard at gmail.com
Fri Apr 27 02:06:38 EDT 2012


2012/4/26 Braden McDaniel <braden at endoframe.com>:
> On 4/26/12 2:45 PM, Eric Noulard wrote:
>>
>> 2012/4/26 Braden McDaniel<braden at endoframe.com>:
>>>
>>> I'm building mysql-connector-c-6.0.2, which uses cmake, on Mac OS X
>>> 10.7.3
>>> using MacPorts cmake 2.8.7.  I have found that "make install" does not
>>> actually install the project's header files.
>>>
>>> When I tried to reproduce this on Linux (Fedora 16), it worked just fine;
>>> so
>>> it looks like this is a Mac-specific (or perhaps even more specific)
>>> problem.
>>>
>>> I'm a total novice at CMake; but I see this in the top-level
>>> CMakeLists.txt:
>>>
>>> INSTALL(DIRECTORY "include/"
>>>        DESTINATION "include"
>>>        FILES_MATCHING PATTERN "*.h")
>>>
>>> Looking at
>>>
>>> http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:install
>>>
>>> ... I don't see anything obviously wrong with that usage.
>>>
>>> The package in question can be found here:
>>>
>>>>
>>>>
>>>> http://mysql.mirrors.pair.com/Downloads/Connector-C/mysql-connector-c-6.0.2.tar.gz
>>
>>
>> This package is dirty because it contains many files coming from some
>> Sparc configuration, the following files are coming from a previous
>> in-source
>> leftover:
>>
>> Makefile
>> CMakeFiles
>> cmake_install.cmake
>> CPackConfig.cmake
>> CPackSourceConfig.cmake
>> CTestTestfile.cmake
>>
>> Remove those files from the source and try
>> a clean out-of-source build&  install:
>> http://www.cmake.org/Wiki/CMake_FAQ#Out-of-source_build_trees
>
>
> I've seen some traffic that led me to question whether this distribution
> works with out-of-source builds; so I did
>
>> find . \( -name Makefile -o -name CMakeFiles -type d -prune -o -name
>> cmake_install.cmake -o -name CPackConfig.cmake -o -name
>> CPackSourceConfig.cmake -o -name CTestTestfile.cmake \) -exec rm -rf  {} ';'
>
>
> and proceeded with an in-source-tree build.
>
> Header files were still not installed.
>
> So, I got the latest sources from launchpad:
>
>  bzr branch lp:libmysql
>
> This version has something slightly different in CMakeLists.txt to install
> the headers:
>
> INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/include/"
>        DESTINATION "include/mysql"
>        FILES_MATCHING PATTERN "*.h")
>
> INSTALL(DIRECTORY "${CMAKE_BINARY_DIR}/include/"
>        DESTINATION "include/mysql"
>        FILES_MATCHING PATTERN "*.h")

This may be done to get a better out-of-source support.

> So, from there, I proceeded with an out-of-source-tree build.
>
> Once again, the headers were not installed.
>
> I began to be suspicious of the possibility of a platform-specific CMake bug
> affecting the file selector (possibly in the pattern matching).  So I tried
> eliminating the pattern selectors from the install directives:
>
> INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/include/"
>        DESTINATION "include/mysql")
>
> INSTALL(DIRECTORY "${CMAKE_BINARY_DIR}/include/"
>        DESTINATION "include/mysql")
>
> This successfully installs the headers (and possibly a bit more).

Very nice bug hunt, well done.

May be you can create a strip down project which exhibit the
possibly MacOS specific issue?

Then open a bug report: http://cmake.org/Bug/
with the example project attached.

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list