[Cmake] Changing the order of entries in the default targets

William A. Hoffman billlist at nycap.rr.com
Fri Sep 3 09:32:47 EDT 2004


Have a look in the FAQ:
http://public.kitware.com/Wiki/CMake_FAQ#How_can_I_generate_a_source_file_during_the_build.3F

You do not want to use a PRE_BUILD command.  You want to use
a generated source file.

-Bill

At 07:42 AM 9/2/2004, Shaul Kedem wrote:
>Hi,
> We have been using cmake for quite some time now, and got into a bit
>of a problem trying to use oracle pro*c with cmake.
>
> We are using HP Unix machines.
>
> pro*c is a precompiler which takes files names <something>.pc and
>outputs <something>.cpp.
>
> We want to have the pro*c output pre compiled for a shared object to use. 
> We used the following ADD_CUSTOM_COMMAND for it:
>ADD_CUSTOM_COMMAND(
> PRE_BUILD
> COMMAND   proc
> ARGS      INAME=../../path/to/file.pc CODE=cpp CPP_SUFFIX=cpp
>SYS_INCLUDE=/usr/include PARSE=NONE
> TARGET    <Shared object>)
>
> The resulted makefile of the above is:
>
>/path/to/shared_object.sl: $(shared_object_SRC_OBJS)
>$(shared_object_EXTERNAL_OBJS)  $(shared_object_DEPEND_LIBS)
>        @echo "Building shared library /path/to/shared_object.sl..."
>        /path/to/cmake -E remove -f /path/to/shared_object.sl
>        proc INAME=/path/to/file.pc CODE=cpp CPP_SUFFIX=cpp
>SYS_INCLUDE=/usr/include PARSE=NONE
>        aCC +Z    +Z -Wl,-E -b -L/usr/lib -o /path/to/shared_object.sl.sl ...
>(and so on..)
>
>As you can see, "proc" (oracle pro*c) will get called only after the
>compiling process has ended.
>
>We have also tried using custom targets but a custom target is not a
>part of the default targets, and so it does not run as part of a
>simple "make" command; on the other hand, using a custom target with
>"ALL", add the custom target at the end of the TARGET variable list.
>This has no relation to where we put the custom target in the cmake
>list file.
>
>Using ADD_DEPENDENCIES didn't work as well, since the shared library
>isn't a custom target.
>
> Please advise - how can we run custom targets in arbitrary places and
>create dependencies between custom targets and other kinds of entries
>in the make file?
>
>Any help will be appreciated,
> Thanks
>_______________________________________________
>Cmake mailing list
>Cmake at www.cmake.org
>http://www.cmake.org/mailman/listinfo/cmake 



More information about the Cmake mailing list