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

Shaul Kedem shaul.kedem at gmail.com
Thu Sep 2 07:42:58 EDT 2004


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


More information about the Cmake mailing list