[CMake] ADD_CUSTOM_COMMAND doesn't create CMake rules

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


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


More information about the CMake mailing list