[Paraview-developers] cmake add_custom_command problem

Pandu Tech pandu4tech at gmail.com
Wed Feb 26 05:47:44 EST 2014


Hi,

I am trying to use add_custom_command in my CMakeLists.txt, but it is not
working properly.

Here is the code:
@@@@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

find_program(PYTHON_EXECUTABLE python)
find_program(CMAKE_EXECUTABLE cmake)

set(CMAKE_INSTALL_PREFIX "/home/Documents/testCMakeBuild")

SET(Output_file1 "cmakeVersion.txt")
SET(Output_file2 "pythonVersion.txt")

ADD_CUSTOM_COMMAND(
    OUTPUT ${CMAKE_INSTALL_PREFIX}/${Output_file1}
    COMMAND ${CMAKE_EXECUTABLE} --version >
${CMAKE_INSTALL_PREFIX}/${Output_file1})

ADD_CUSTOM_TARGET(cmakeInternal ALL DEPENDS
${CMAKE_INSTALL_PREFIX}/${Output_file1})


ADD_CUSTOM_COMMAND(
    OUTPUT ${CMAKE_INSTALL_PREFIX}/${Output_file2}
    COMMAND ${PYTHON_EXECUTABLE} --version >
${CMAKE_INSTALL_PREFIX}/${Output_file2})

ADD_CUSTOM_TARGET(pythonInternal ALL DEPENDS
${CMAKE_INSTALL_PREFIX}/${Output_file2})

@@@@@@@@@

In case of cmakeVersion.txt, o/p of cmake --version is written to
cmakeVersion.txt and nothing is printed to console, but in case of python
just o/p of python --version is written to console. pythonVersion.txt is
created but file is empty.

Please share your views.

Appreciate your help in this regard.

Thanks,
Pandu.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20140226/9760de94/attachment.html>


More information about the Paraview-developers mailing list