[CMake] ExternalPackage_Add with Non-CMake project that runs differently then equivalent shell script

Chad Balen cbalen at ualberta.ca
Fri May 23 17:23:38 EDT 2014


Hello,

I'm trying to install an Metis as an external package to our software and
I'm having some issues. The typical shell script that I ran before to
install Metis was:

$ make config shared=1 prefix=/path/to/installation
$ make
$ make install

So I tried to use the following in the ExternalPackage_Add function:

ExternalProject_Add(
  Metis

  URL ${CMAKE_SOURCE_DIR}/contrib/Metis/metis-5.1.0.tar.gz
  PREFIX Metis
  UPDATE_COMMAND ""

  CONFIGURE_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/Metis/src/Metis && make
config shared=1 prefix=${CMAKE_INSTALL_PREFIX}/contrib/Metis

  BUILD_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/Metis/src/Metis && make

  INSTALL_COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/Metis/src/Metis && make
install

  INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/contrib/Metis
)

However, near the end of the Build phase I get this error:

[100%] Built target ndmetis
make[4]: *** No rule to make target `s'.  Stop.
make[3]: *** [all] Error 2
make[2]: *** [Metis/src/Metis-stamp/Metis-build] Error 2
make[1]: *** [CMakeFiles/Metis.dir/all] Error 2
make: *** [all] Error 2

I don't get where this error is coming from because when I run these
commands in terminal it runs perfectly fine and it says:

[100%] Built target ndmetis
make[2]: Leaving directory
`/home/cbalen/ConvertCmake/CMakeTutorial/Mine/12a_Metis/Build/Metis/src/Metis/build/Linux-x86_64'
/usr/bin/cmake -E cmake_progress_start
/home/cbalen/ConvertCmake/CMakeTutorial/Mine/12a_Metis/Build/Metis/src/Metis/build/Linux-x86_64/CMakeFiles
0
make[1]: Leaving directory
`/home/cbalen/ConvertCmake/CMakeTutorial/Mine/12a_Metis/Build/Metis/src/Metis/build/Linux-x86_64'


My questions are:
1. From what I see from other examples, other people do not put the
following:

cd ${CMAKE_CURRENT_BINARY_DIR}/Metis/src/Metis &&

to run bash commands

However if I do that it claims: make[3]: *** No rule to make target
`config'.  Stop

2. From my understanding I should be able to leave the BUILD_COMMAND and
INSTALL_COMMAND empty however if I do that it claims:

make[3]: *** No targets specified and no makefile found.  Stop.

But a makefile in Build/Metis/src/Metis where CMake CMake extracts the
Metis tar file into. So I guess this is related to 1 but where does CMake
do these commands that it can't see the Makefile and I have to send it to
the folder specifically to run these commands?

3. I've also built a simple shell script that runs these three commands,
when I run the script in terminal it installs without errors. But when I
have CMake run that same shell script like so:

ExternalProject_Add(
  Metis
  URL ${CMAKE_SOURCE_DIR}/contrib/Metis/metis-5.1.0.tar.gz
  PREFIX Metis
  UPDATE_COMMAND ""

  CONFIGURE_COMMAND ""
  BUILD_COMMAND ""
  INSTALL_COMMAND cd ${CMAKE_SOURCE_DIR}/contrib/Metis && ./configure_metis
)

I get the same error as before saying: No rule to make target `s'.  Stop.

what is CMake doing differently then when I run my shell script by itself?

4. Does anyone know what is going on and how to fix this issue. Is this a
possible bug cause I've done the same thing with other non cmake projects
(like p4est, PETSc) and I do not have this issue.


Thanks for the help,
Chad

--
Chad Balen
Energy Systems Design Laboratory,
3-23 Mechanical Engineering Building,
University of Alberta,
Edmonton, AB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140523/616f3c8e/attachment.html>


More information about the CMake mailing list