[CMake] ADD_CUSTOM_COMMAND doesn't create CMake rules

Schick, Thorben (ITUC; ADITG/DFG) tschick at de.adit-jv.com
Fri Mar 14 06:25:42 EDT 2008


 
And thats exactls the problem...i can't add them via ADD_EXECUTABLE because they don't exist while running CMake...they should be created when the build process is started out of Visual Studio...

Regards
Thorben

-----Original Message-----
From: BlinkEye [mailto:gentoo at blinkeye.ch] 
Sent: Freitag, 14. März 2008 09:16
To: Schick, Thorben (ITUC; ADITG/DFG)
Subject: Re: [CMake] ADD_CUSTOM_COMMAND doesn't create CMake rules

You must use the generated files of a ADD_CUSTOM_COMMAND as a dependency.

> SET (_ui C:/...view_tool/tmp/intf/data_search.h)
> SET (_file C:/.../view_tool/ui/data_search.ui)
> ADD_CUSTOM_COMMAND(OUTPUT ${_ui}
>                        COMMAND ${QT_UIC_EXECUTABLE}
>                    ARGS -o ${_ui} ${_file}
>                   COMMENT "Creating intf ${_ui} from ui ${_file}"
> )

e.g.:

add_executable( myexe ${_ui} foo.C bar.C )

or:

add_custom_target( myexe DEPENDS ${_ui} )


On Fri, March 14, 2008 08:05, Schick, Thorben \(ITUC; ADITG/DFG\) wrote:
> Hi Andy,
>
> i've studied the FindQT.cmake for quite a long time, the same with 
> FINDQT4.cmake, but that doesn't solve my problem. I think you mean 
> something like the ADD_EXECUTABLE statement described in http://qtnode.net/wiki?title=Qt_with_cmake.
> But if i add the ui_*.h file list there with
>
> INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
> ADD_EXECUTABLE( ${ProjectName} EXCLUDE_FROM_ALL ${DirSources} 
> ${DriverDir}/main.cc
> ${_project_ui_h})
>
> wehre ${_project_ui_h} is the list of ui_*.h files that should be 
> generated during the build process, there occurs errors like
>
> Cmake Error: Cannot find source file "....\ui_*.h" for target...
>
> That's logical because these files doesn't exist yet.
>
> Regards
> Thorben
>
> -----Original Message-----
> From: Andy Lego [mailto:legoandy at gmail.com]
> Sent: Mittwoch, 12. März 2008 18:30
> To: Schick, Thorben (ITUC; ADITG/DFG)
> Cc: cmake at cmake.org
> Subject: Re: [CMake] ADD_CUSTOM_COMMAND doesn't create CMake rules
>
> Hello Thorben,
>
> You need something that drives the custom command, such as custom target.
>
> That said, if you are doing QT stuff, you should really look at FindQT.cmake.
>
> Andy
>
> On Wed, Mar 12, 2008 at 9:45 AM, Schick, Thorben (ITUC; ADITG/DFG) 
> <tschick at de.adit-jv.com> wrote:
>>
>>
>>
>> I am trying to use CMake to create the build information for MS 
>> Visual Studio .NET 2003 including some QT UIs. I added the following 
>> code to create the accordant building rules. Due to readability i give only some examples.
>> I realized creation with a loop over all necessary uis and looping 
>> works fine :-)
>>
>> QT executables were also set correct.
>>
>> SET (_ui C:/.../view_tool/tmp/intf/zoom_to_tile_by_id.h)
>> SET (_file C:/.../view_tool/ui/zoom_to_tile_by_id.ui)
>> ADD_CUSTOM_COMMAND(OUTPUT ${_ui}
>>                        COMMAND ${QT_UIC_EXECUTABLE}
>>                       ARGS -o ${_ui} ${_file}
>>                       COMMENT "Creating intf ${_ui} from ui ${_file}"
>> )
>> SET (_ui C:/...view_tool/tmp/intf/data_search.h)
>> SET (_file C:/.../view_tool/ui/data_search.ui)
>> ADD_CUSTOM_COMMAND(OUTPUT ${_ui}
>>                        COMMAND ${QT_UIC_EXECUTABLE}
>>                    ARGS -o ${_ui} ${_file}
>>                   COMMENT "Creating intf ${_ui} from ui ${_file}"
>> )
>>
>> The problem is, that for the first ui (and some other in the whole 
>> list too) there is no CMake rule created, but for the second file 
>> (and some other files of the whole list) it is. If i expand the 
>> outputfiles by a leading "ui_", i.e.:
>>
>> SET (_ui C:/...view_tool/tmp/intf/ui_data_search.h)
>> SET (_file C:/.../view_tool/ui/data_search.ui)
>> ADD_CUSTOM_COMMAND(OUTPUT ${_ui}
>>                        COMMAND ${QT_UIC_EXECUTABLE}
>>                    ARGS -o ${_ui} ${_file}
>>                   COMMENT "Creating intf ${_ui} from ui ${_file}"
>> )
>>
>> there will be no rules created. I can't imagine where the problem is, 
>> because the code is nearly the same as in the QT4_WRAP_UI macro 
>> delivered with CMake.
>>
>> Regards
>> Thorben
>> _______________________________________________
>>  CMake mailing list
>>  CMake at cmake.org
>>  http://www.cmake.org/mailman/listinfo/cmake
>>
>
>
>
> --
> http://legoandy.com -o- http://capitalmtb.org
>
> Support my 150 mile bike ride to fight MS:
> http://bikecan.nationalmssociety.org/site/TR?px=3921627&pg=personal&fr
> _id=9066 _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>




More information about the CMake mailing list