[Cmake] Object Suffixes

Andy Cedilnik andy . cedilnik at kitware . com
10 Jul 2003 07:42:23 -0400


Hi Peter,

Why not do this in CMake?

Here we go:

PROJECT(WRAPPER NONE)

SET(MYPROJECT_SOURCE_DIR "/home/z/World")

SET(SRCDIR "${MYPROJECT_SOURCE_DIR}")
SET(BINDIR "${WRAPPER_BINARY_DIR}/MyProject-${CMAKE_SYSTEM_NAME}")
ADD_CUSTOM_TARGET(build "${CMAKE_COMMAND} -E chdir ${BINDIR}
${CMAKE_BUILD_TOOL}")
ADD_CUSTOM_TARGET(cmake "${CMAKE_COMMAND} -E chdir ${BINDIR}
${CMAKE_EDIT_COMMAND} ${SRCDIR}")

This should work on all unixes.

Now you type:

make cmake
// answer all the questions
// then type

make build


			Andy

On Thu, 2003-07-10 at 03:21, Peter Vanroose wrote:
> >     I don't mean to keep pestering you, but this solution doesn't seem
> > to answer my question.  With your example, I have directories
> >
> > /home/z/world
> > /home/z/world-linux
> > /home/z/world-sun
> >
> > and the sources in /home/z/world.  I want to be able to run make without
> > knowing which system I'm on.
> 
> Your setup can work with a simple additional makefile (hand-made) in
> /home/z/world, which determines the operating system and then delegates
> to one of the CMake generated ones, either in world-linux or world-sun.
> 
> Thus /home/z/world/makefile could look like this:
> (I'm assuming unix and gnu make; more general is possible.)
> 
> ### This is /home/z/world/makefile ###
> # Run uname to distinguish unix systems
> uname_output := $(strip $(shell uname))
> 
> ifneq (,$(findstring SunOS,$(uname_output)))
>   cd ../world-sun && make
> endif
> 
> ifneq (,$(findstring Linux,$(uname_output)))
>   cd ../world-linux && make
> endif
> ### end of makefile ###