Debug problem with component install

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Debug problem with component install

Andreas Pakulat-2
Hi,

I'm having a project here where cmake refuses to recognize the "COMPONENT" option for the install() command for certain targets.

Within the project there are several subdirs, the top-level CMakeLists.txt has a component-install rule like this:

INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/html DESTINATION share/doc/myapp COMPONENT documentation)

which generates the expected output in the cmake_install.cmake file. However several subdirectories contain executable targets for which the cmake_install.cmake file uses the "Unspecified" component. The executable target files look like this:

SET(SOURCES
        main.cpp object.cpp)

SET(MOCABLES
        object.h)

QT4_WRAP_CPP(MOC_SOURCES ${MOCABLES})

ADD_EXECUTABLE(myapp ${SOURCES} ${MOC_SOURCES})
TARGET_LINK_LIBRARIES(myapp ${QT_LIBRARIES})

# Installation
INSTALL(TARGETS myapp RUNTIME DESTINATION bin
                       ARCHIVE DESTINATION lib
                       LIBRARY DESTINATION lib
                       COMPONENT applications)

I can't seem to find a reason for this misbehaviour using cmake --trace or cmake --debug-output. Are there any other ways (short of patching + compiling cmake) to find out what goes wrong here? And if not, can someone give me a hint where to start patching?

I'm using cmake 2.8.11.2 on Debian/GNU Linux.

In a very small example with just an executable target in a single cmake file everything works fine, but minimizing the real codebase is quite a bit harder than I thought.

Andreas

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Debug problem with component install

Andreas Pakulat-2
Hi,

On Sat, Jul 27, 2013 at 12:39 AM, Andreas Pakulat <[hidden email]> wrote:
Hi,

I'm having a project here where cmake refuses to recognize the "COMPONENT" option for the install() command for certain targets.

Within the project there are several subdirs, the top-level CMakeLists.txt has a component-install rule like this:

INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/html DESTINATION share/doc/myapp COMPONENT documentation)

which generates the expected output in the cmake_install.cmake file. However several subdirectories contain executable targets for which the cmake_install.cmake file uses the "Unspecified" component. The executable target files look like this:

SET(SOURCES
        main.cpp object.cpp)

SET(MOCABLES
        object.h)

QT4_WRAP_CPP(MOC_SOURCES ${MOCABLES})

ADD_EXECUTABLE(myapp ${SOURCES} ${MOC_SOURCES})
TARGET_LINK_LIBRARIES(myapp ${QT_LIBRARIES})

# Installation
INSTALL(TARGETS myapp RUNTIME DESTINATION bin
                       ARCHIVE DESTINATION lib
                       LIBRARY DESTINATION lib
                       COMPONENT applications)

I can't seem to find a reason for this misbehaviour using cmake --trace or cmake --debug-output. Are there any other ways (short of patching + compiling cmake) to find out what goes wrong here? And if not, can someone give me a hint where to start patching?

I'm using cmake 2.8.11.2 on Debian/GNU Linux.

In a very small example with just an executable target in a single cmake file everything works fine, but minimizing the real codebase is quite a bit harder than I thought.

It seems that the issue is that I'm listing 'COMPONENT' after the various destinations. This seems to confuse the parsing of the arguments in cmInstallCommand, as the genericArgs in ::HandleTargetsMode always yields 'Unspecified' unless I move COMPONENT before the DESTINATIONS.

The cmake docs do not indicate any importance on the order, but I finally have a minimal testcase and can file a bugreport.

Andreas 
 

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Debug problem with component install

Eric Noulard
2013/7/31 Andreas Pakulat <[hidden email]>:

> Hi,
>
> On Sat, Jul 27, 2013 at 12:39 AM, Andreas Pakulat <[hidden email]> wrote:
>>
>> Hi,
>>
>> I'm having a project here where cmake refuses to recognize the "COMPONENT"
>> option for the install() command for certain targets.
>>
>> Within the project there are several subdirs, the top-level CMakeLists.txt
>> has a component-install rule like this:
>>
>> INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/html DESTINATION
>> share/doc/myapp COMPONENT documentation)
>>
>> which generates the expected output in the cmake_install.cmake file.
>> However several subdirectories contain executable targets for which the
>> cmake_install.cmake file uses the "Unspecified" component. The executable
>> target files look like this:
>>
>> SET(SOURCES
>>         main.cpp object.cpp)
>>
>> SET(MOCABLES
>>         object.h)
>>
>> QT4_WRAP_CPP(MOC_SOURCES ${MOCABLES})
>>
>> ADD_EXECUTABLE(myapp ${SOURCES} ${MOC_SOURCES})
>> TARGET_LINK_LIBRARIES(myapp ${QT_LIBRARIES})
>>
>> # Installation
>> INSTALL(TARGETS myapp RUNTIME DESTINATION bin
>>                        ARCHIVE DESTINATION lib
>>                        LIBRARY DESTINATION lib
>>                        COMPONENT applications)
>>
>> I can't seem to find a reason for this misbehaviour using cmake --trace or
>> cmake --debug-output. Are there any other ways (short of patching +
>> compiling cmake) to find out what goes wrong here? And if not, can someone
>> give me a hint where to start patching?
>>
>> I'm using cmake 2.8.11.2 on Debian/GNU Linux.
>>
>> In a very small example with just an executable target in a single cmake
>> file everything works fine, but minimizing the real codebase is quite a bit
>> harder than I thought.
>
>
> It seems that the issue is that I'm listing 'COMPONENT' after the various
> destinations. This seems to confuse the parsing of the arguments in
> cmInstallCommand, as the genericArgs in ::HandleTargetsMode always yields
> 'Unspecified' unless I move COMPONENT before the DESTINATIONS.

I'm not sure to fully understand your testcase but
the keywords specified after ARCHIVE|LIBRARY|RUNTIME|FRAMEWORK|BUNDLE|
                   PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE

should be repeated for each of them.

i.e. one shall not write
INSTALL(TARGETS myapp
                        RUNTIME DESTINATION bin
                        ARCHIVE DESTINATION lib
                        LIBRARY DESTINATION lib
                        COMPONENT applications)

but
INSTALL(TARGETS myapp
                        RUNTIME DESTINATION bin COMPONENT applications
                        ARCHIVE DESTINATION lib COMPONENT applications
                        LIBRARY DESTINATION lib COMPONENT applications)

I.e COMPONENT should be repeated just as "DESTINATION" is.

> The cmake docs do not indicate any importance on the order, but I finally
> have a minimal testcase and can file a bugreport.

I don't think the doc is wrong but the nested bracket level [[[ ]]]
makes it confusing to understand.


--
Erk
L'élection n'est pas la démocratie -- http://www.le-message.org
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Debug problem with component install

Andreas Pakulat-2
Hi,

On Wed, Jul 31, 2013 at 10:52 PM, Eric Noulard <[hidden email]> wrote:
2013/7/31 Andreas Pakulat <[hidden email]>:
> Hi,
>
> On Sat, Jul 27, 2013 at 12:39 AM, Andreas Pakulat <[hidden email]> wrote:
>>
>> Hi,
>>
>> I'm having a project here where cmake refuses to recognize the "COMPONENT"
>> option for the install() command for certain targets.
>>
>> Within the project there are several subdirs, the top-level CMakeLists.txt
>> has a component-install rule like this:
>>
>> INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/html DESTINATION
>> share/doc/myapp COMPONENT documentation)
>>
>> which generates the expected output in the cmake_install.cmake file.
>> However several subdirectories contain executable targets for which the
>> cmake_install.cmake file uses the "Unspecified" component. The executable
>> target files look like this:
>>
>> SET(SOURCES
>>         main.cpp object.cpp)
>>
>> SET(MOCABLES
>>         object.h)
>>
>> QT4_WRAP_CPP(MOC_SOURCES ${MOCABLES})
>>
>> ADD_EXECUTABLE(myapp ${SOURCES} ${MOC_SOURCES})
>> TARGET_LINK_LIBRARIES(myapp ${QT_LIBRARIES})
>>
>> # Installation
>> INSTALL(TARGETS myapp RUNTIME DESTINATION bin
>>                        ARCHIVE DESTINATION lib
>>                        LIBRARY DESTINATION lib
>>                        COMPONENT applications)
>>
>> I can't seem to find a reason for this misbehaviour using cmake --trace or
>> cmake --debug-output. Are there any other ways (short of patching +
>> compiling cmake) to find out what goes wrong here? And if not, can someone
>> give me a hint where to start patching?
>>
>> I'm using cmake 2.8.11.2 on Debian/GNU Linux.
>>
>> In a very small example with just an executable target in a single cmake
>> file everything works fine, but minimizing the real codebase is quite a bit
>> harder than I thought.
>
>
> It seems that the issue is that I'm listing 'COMPONENT' after the various
> destinations. This seems to confuse the parsing of the arguments in
> cmInstallCommand, as the genericArgs in ::HandleTargetsMode always yields
> 'Unspecified' unless I move COMPONENT before the DESTINATIONS.

I'm not sure to fully understand your testcase but
the keywords specified after ARCHIVE|LIBRARY|RUNTIME|FRAMEWORK|BUNDLE|
                   PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE

should be repeated for each of them.

i.e. one shall not write
INSTALL(TARGETS myapp
                        RUNTIME DESTINATION bin
                        ARCHIVE DESTINATION lib
                        LIBRARY DESTINATION lib
                        COMPONENT applications)

but
INSTALL(TARGETS myapp
                        RUNTIME DESTINATION bin COMPONENT applications
                        ARCHIVE DESTINATION lib COMPONENT applications
                        LIBRARY DESTINATION lib COMPONENT applications)

I.e COMPONENT should be repeated just as "DESTINATION" is.

> The cmake docs do not indicate any importance on the order, but I finally
> have a minimal testcase and can file a bugreport.

I don't think the doc is wrong but the nested bracket level [[[ ]]]
makes it confusing to understand.

Ugh, you're right and yes the brackets really don't help in understanding this. Well 


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Debug problem with component install

Eric Noulard
2013/7/31 Andreas Pakulat <[hidden email]>:

> Hi,
>
> On Wed, Jul 31, 2013 at 10:52 PM, Eric Noulard <[hidden email]>
> wrote:
>>
>> 2013/7/31 Andreas Pakulat <[hidden email]>:
>> > Hi,
>> >
>> > On Sat, Jul 27, 2013 at 12:39 AM, Andreas Pakulat <[hidden email]> wrote:
>> >>
>> >> Hi,
>> >>
>> >> I'm having a project here where cmake refuses to recognize the
>> >> "COMPONENT"
>> >> option for the install() command for certain targets.
>> >>
>> >> Within the project there are several subdirs, the top-level
>> >> CMakeLists.txt
>> >> has a component-install rule like this:
>> >>
>> >> INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/doc/html DESTINATION
>> >> share/doc/myapp COMPONENT documentation)
>> >>
>> >> which generates the expected output in the cmake_install.cmake file.
>> >> However several subdirectories contain executable targets for which the
>> >> cmake_install.cmake file uses the "Unspecified" component. The
>> >> executable
>> >> target files look like this:
>> >>
>> >> SET(SOURCES
>> >>         main.cpp object.cpp)
>> >>
>> >> SET(MOCABLES
>> >>         object.h)
>> >>
>> >> QT4_WRAP_CPP(MOC_SOURCES ${MOCABLES})
>> >>
>> >> ADD_EXECUTABLE(myapp ${SOURCES} ${MOC_SOURCES})
>> >> TARGET_LINK_LIBRARIES(myapp ${QT_LIBRARIES})
>> >>
>> >> # Installation
>> >> INSTALL(TARGETS myapp RUNTIME DESTINATION bin
>> >>                        ARCHIVE DESTINATION lib
>> >>                        LIBRARY DESTINATION lib
>> >>                        COMPONENT applications)
>> >>
>> >> I can't seem to find a reason for this misbehaviour using cmake --trace
>> >> or
>> >> cmake --debug-output. Are there any other ways (short of patching +
>> >> compiling cmake) to find out what goes wrong here? And if not, can
>> >> someone
>> >> give me a hint where to start patching?
>> >>
>> >> I'm using cmake 2.8.11.2 on Debian/GNU Linux.
>> >>
>> >> In a very small example with just an executable target in a single
>> >> cmake
>> >> file everything works fine, but minimizing the real codebase is quite a
>> >> bit
>> >> harder than I thought.
>> >
>> >
>> > It seems that the issue is that I'm listing 'COMPONENT' after the
>> > various
>> > destinations. This seems to confuse the parsing of the arguments in
>> > cmInstallCommand, as the genericArgs in ::HandleTargetsMode always
>> > yields
>> > 'Unspecified' unless I move COMPONENT before the DESTINATIONS.
>>
>> I'm not sure to fully understand your testcase but
>> the keywords specified after ARCHIVE|LIBRARY|RUNTIME|FRAMEWORK|BUNDLE|
>>                    PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE
>>
>> should be repeated for each of them.
>>
>> i.e. one shall not write
>> INSTALL(TARGETS myapp
>>                         RUNTIME DESTINATION bin
>>                         ARCHIVE DESTINATION lib
>>                         LIBRARY DESTINATION lib
>>                         COMPONENT applications)
>>
>> but
>> INSTALL(TARGETS myapp
>>                         RUNTIME DESTINATION bin COMPONENT applications
>>                         ARCHIVE DESTINATION lib COMPONENT applications
>>                         LIBRARY DESTINATION lib COMPONENT applications)
>>
>> I.e COMPONENT should be repeated just as "DESTINATION" is.
>>
>> > The cmake docs do not indicate any importance on the order, but I
>> > finally
>> > have a minimal testcase and can file a bugreport.
>>
>> I don't think the doc is wrong but the nested bracket level [[[ ]]]
>> makes it confusing to understand.
>
>
> Ugh, you're right and yes the brackets really don't help in understanding
> this. Well

Yes I do agree on that, you are not the first to get bitten by that.
May be some warning could be spitted out in some case when
COMPONENT appears once at a possibly wrong place.

That said, doing that in a backward compatible manner does not seems to be easy.

Adding a warning on that matter in the doc may be useful, even if the
doc of "install"
command is already huge.

Others may have better idea?

--
Erk
L'élection n'est pas la démocratie -- http://www.le-message.org
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake