Re: [CMake] How to fetch exit status of INSTALL(CODE ...)

2011-07-20 Thread Jean-Christophe Fillion-Robin
Hi Marcel,

Aware I won't be answering your question regarding the exit code associated
with INSTALL(CODE ...), I still would like to suggest you an approach that
could help you addressing your issue.

What about byte-compiling the python source at build time ? In that case,
the build step would fail instead ...

You could look at macro like this one to help you: See
https://github.com/commontk/CTK/blob/master/CMake/ctkMacroCompilePythonScript.cmake

Hth
Jc

On Wed, Jul 20, 2011 at 3:47 AM, Marcel Loose lo...@astron.nl wrote:

 Hi all,

 I have a macro that, during install, compiles python source files to
 byte code. Sometimes, there's a syntax error in the python source that
 can be caught during compilation; i.e. during the execution of
 INSTALL(CODE ...).

 Is is possible to somehow fetch the exit status of commands executed
 inside INSTALL(CODE ...), so that I can let 'make install' exit with a
 non-zero exit status?

 Best regards,
 Marcel Loose.

 --
 Marcel Loose
 Senior Software Engineer, Computing Group RD, Astron, the Netherlands

 ___
 Powered by www.kitware.com

 Visit other Kitware open-source projects at
 http://www.kitware.com/opensource/opensource.html

 Please keep messages on-topic and check the CMake FAQ at:
 http://www.cmake.org/Wiki/CMake_FAQ

 Follow this link to subscribe/unsubscribe:
 http://www.cmake.org/mailman/listinfo/cmake




-- 
+1 919 869 8849
___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] How to fetch exit status of INSTALL(CODE ...)

2011-07-20 Thread Marcel Loose
Hi Jc,

Thanks for the tip. It makes sense to let the build fail early (i.e.
during compilation, instead of installation). I'll take it into
consideration.

Regards,
Marcel Loose.

On Wed, 2011-07-20 at 06:41 -0400, Jean-Christophe Fillion-Robin wrote:
 Hi Marcel,
 
 Aware I won't be answering your question regarding the exit code
 associated with INSTALL(CODE ...), I still would like to suggest you
 an approach that could help you addressing your issue.
 
 What about byte-compiling the python source at build time ? In that
 case, the build step would fail instead ... 
 
 You could look at macro like this one to help you: See

https://github.com/commontk/CTK/blob/master/CMake/ctkMacroCompilePythonScript.cmake
 
 Hth
 Jc
 
 On Wed, Jul 20, 2011 at 3:47 AM, Marcel Loose lo...@astron.nl wrote:
 Hi all,
 
 I have a macro that, during install, compiles python source
 files to
 byte code. Sometimes, there's a syntax error in the python
 source that
 can be caught during compilation; i.e. during the execution of
 INSTALL(CODE ...).
 
 Is is possible to somehow fetch the exit status of commands
 executed
 inside INSTALL(CODE ...), so that I can let 'make install'
 exit with a
 non-zero exit status?
 
 Best regards,
 Marcel Loose.
 
 --
 Marcel Loose
 Senior Software Engineer, Computing Group RD, Astron, the
 Netherlands
 
 ___
 Powered by www.kitware.com
 
 Visit other Kitware open-source projects at
 http://www.kitware.com/opensource/opensource.html
 
 Please keep messages on-topic and check the CMake FAQ at:
 http://www.cmake.org/Wiki/CMake_FAQ
 
 Follow this link to subscribe/unsubscribe:
 http://www.cmake.org/mailman/listinfo/cmake
 
 
 
 -- 
 +1 919 869 8849
 



___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] How to fetch exit status of INSTALL(CODE ...)

2011-07-20 Thread David Cole
To produce an error from an install(CODE snippet, simply add:

  if(error)
message(FATAL_ERROR \error message here\)
  endif()

inside the CODE based on some other error flag also in your CODE...


On Wed, Jul 20, 2011 at 7:45 AM, Marcel Loose lo...@astron.nl wrote:

 Hi Jc,

 Thanks for the tip. It makes sense to let the build fail early (i.e.
 during compilation, instead of installation). I'll take it into
 consideration.

 Regards,
 Marcel Loose.

 On Wed, 2011-07-20 at 06:41 -0400, Jean-Christophe Fillion-Robin wrote:
  Hi Marcel,
 
  Aware I won't be answering your question regarding the exit code
  associated with INSTALL(CODE ...), I still would like to suggest you
  an approach that could help you addressing your issue.
 
  What about byte-compiling the python source at build time ? In that
  case, the build step would fail instead ...
 
  You could look at macro like this one to help you: See
 

 https://github.com/commontk/CTK/blob/master/CMake/ctkMacroCompilePythonScript.cmake
 
  Hth
  Jc
 
  On Wed, Jul 20, 2011 at 3:47 AM, Marcel Loose lo...@astron.nl wrote:
  Hi all,
 
  I have a macro that, during install, compiles python source
  files to
  byte code. Sometimes, there's a syntax error in the python
  source that
  can be caught during compilation; i.e. during the execution of
  INSTALL(CODE ...).
 
  Is is possible to somehow fetch the exit status of commands
  executed
  inside INSTALL(CODE ...), so that I can let 'make install'
  exit with a
  non-zero exit status?
 
  Best regards,
  Marcel Loose.
 
  --
  Marcel Loose
  Senior Software Engineer, Computing Group RD, Astron, the
  Netherlands
 
  ___
  Powered by www.kitware.com
 
  Visit other Kitware open-source projects at
  http://www.kitware.com/opensource/opensource.html
 
  Please keep messages on-topic and check the CMake FAQ at:
  http://www.cmake.org/Wiki/CMake_FAQ
 
  Follow this link to subscribe/unsubscribe:
  http://www.cmake.org/mailman/listinfo/cmake
 
 
 
  --
  +1 919 869 8849
 



 ___
 Powered by www.kitware.com

 Visit other Kitware open-source projects at
 http://www.kitware.com/opensource/opensource.html

 Please keep messages on-topic and check the CMake FAQ at:
 http://www.cmake.org/Wiki/CMake_FAQ

 Follow this link to subscribe/unsubscribe:
 http://www.cmake.org/mailman/listinfo/cmake

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] How to fetch exit status of INSTALL(CODE ...)

2011-07-20 Thread Marcel Loose
Thanks David,

I never realized you can use just about any CMake-construct inside
CODE... 

Regards,
Marcel Loose.

On Wed, 2011-07-20 at 10:41 -0400, David Cole wrote:
 To produce an error from an install(CODE snippet, simply add:
 
 
   if(error)
 message(FATAL_ERROR \error message here\)
   endif()
 
 
 inside the CODE based on some other error flag also in your CODE...
 
 
 On Wed, Jul 20, 2011 at 7:45 AM, Marcel Loose lo...@astron.nl wrote:
 Hi Jc,
 
 Thanks for the tip. It makes sense to let the build fail early
 (i.e.
 during compilation, instead of installation). I'll take it
 into
 consideration.
 
 Regards,
 Marcel Loose.
 
 
 On Wed, 2011-07-20 at 06:41 -0400, Jean-Christophe
 Fillion-Robin wrote:
  Hi Marcel,
 
  Aware I won't be answering your question regarding the exit
 code
  associated with INSTALL(CODE ...), I still would like to
 suggest you
  an approach that could help you addressing your issue.
 
  What about byte-compiling the python source at build time ?
 In that
  case, the build step would fail instead ...
 
  You could look at macro like this one to help you: See
 

https://github.com/commontk/CTK/blob/master/CMake/ctkMacroCompilePythonScript.cmake
 
  Hth
  Jc
 
  On Wed, Jul 20, 2011 at 3:47 AM, Marcel Loose
 lo...@astron.nl wrote:
  Hi all,
 
  I have a macro that, during install, compiles python
 source
  files to
  byte code. Sometimes, there's a syntax error in the
 python
  source that
  can be caught during compilation; i.e. during the
 execution of
  INSTALL(CODE ...).
 
  Is is possible to somehow fetch the exit status of
 commands
  executed
  inside INSTALL(CODE ...), so that I can let 'make
 install'
  exit with a
  non-zero exit status?
 
  Best regards,
  Marcel Loose.
 
  --
  Marcel Loose
  Senior Software Engineer, Computing Group RD,
 Astron, the
  Netherlands
 
  ___
  Powered by www.kitware.com
 
  Visit other Kitware open-source projects at
  http://www.kitware.com/opensource/opensource.html
 
  Please keep messages on-topic and check the CMake
 FAQ at:
  http://www.cmake.org/Wiki/CMake_FAQ
 
  Follow this link to subscribe/unsubscribe:
  http://www.cmake.org/mailman/listinfo/cmake
 
 
 
  --
  +1 919 869 8849
 
 
 
 
 ___
 Powered by www.kitware.com
 
 Visit other Kitware open-source projects at
 http://www.kitware.com/opensource/opensource.html
 
 Please keep messages on-topic and check the CMake FAQ at:
 http://www.cmake.org/Wiki/CMake_FAQ
 
 Follow this link to subscribe/unsubscribe:
 http://www.cmake.org/mailman/listinfo/cmake
 
 
 



___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake