[CMake] Adding install dependency to test-target?

Michael Jackson mike.jackson at bluequartz.net
Thu Jan 29 13:45:04 EST 2009


You probably want to investigate "ADDITIONAL_MAKE_CLEAN_FILES" property.
_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Jan 29, 2009, at 1:28 PM, Aaron Turner wrote:

> On Thu, Jan 29, 2009 at 9:41 AM, Michael Jackson
> <mike.jackson at bluequartz.net> wrote:
>
>> The error you are getting is because there is no target named  
>> "clean".
>> Granted, when makefiles are created there is a "make" target called  
>> "clean"
>> but you have not defined a target within your project named "clean".
>
> Ok, make sense.
>
>> Try
>> putting the name of one of your actual targets (like a library that  
>> depends
>> on libopts) in the add_custom_command instead and see if that works.
>
> Now you lost me.   What add_custom_command are you referring to?
>
> Here's my config:
>
> IF(USE_AUTOOPTS)
>    ADD_CUSTOM_TARGET(libopts ALL
>        DEPENDS ${CMAKE_SOURCE_DIR}/libopts/.libs/libopts.a)
>
>    ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_SOURCE_DIR}/libopts/Makefile
>        ${CMAKE_SOURCE_DIR}/libopts/config.h
>        ${CMAKE_SOURCE_DIR}/test/Makefile
>        ${CMAKE_SOURCE_DIR}/docs/Makefile
>        ${CMAKE_SOURCE_DIR}/doxygen.cfg
>        PRE_BUILD
>        COMMAND ${CMAKE_SOURCE_DIR}/configure)
>
>    ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_SOURCE_DIR}/libopts/.libs/ 
> libopts.a
>        PRE_BUILD
>        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libopts
>        COMMAND ${MAKE}
>        DEPENDS ${CMAKE_SOURCE_DIR}/libopts/Makefile)
>
>    ADD_CUSTOM_TARGET(clean_libopts
>        COMMAND ${MAKE} clean
>        COMMAND rm -f Makefile
>        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libopts)
>
>    # ADD_DEPENDENCIES(clean clean_libopts)
> ENDIF(USE_AUTOOPTS)
>
> # then later on, I do things like:
>
> SET(libs ${CMAKE_SOURCE_DIR}/libopts/.libs/libopts.a <other libs>)
> TARGET_LINK_LIBRARIES(tcpreplay ${libs})
>
> -- 
> Aaron Turner
> http://synfin.net/
> http://tcpreplay.synfin.net/ - Pcap editing and replay tools for  
> Unix & Windows
> Those who would give up essential Liberty, to purchase a little
> temporary Safety,
> deserve neither Liberty nor Safety.
>    -- Benjamin Franklin



More information about the CMake mailing list