On 8/6/10 1:12 PM, Magnus Therning wrote:
I was trying to put something like this into a CMake file:
add_custom_command( ...
COMMAND ...
COMMAND ([[ -f foo ]] || ln -sf foo bar); true
)
But CMake won't have it. Skipping the sub-shell is all right with CMake:
add_custom_command( ...
COMMAND ...
COMMAND [[ -f foo ]] || ln -sf foo bar
)
But then make doesn't like it if the file doesn't exist, it exits with an
error.
I put the command in an external shell script instead, but would rather
not do
that.
Any suggestions?
/M
You could create/dynamically at configure time write out a cmake file
that does something to the effect of:
if(EXISTS foo)
execute_process(COMMAND ${CMAKE_COMMAND}) -E create_symlink
oldfilename newfilename)
endif()
then make your custom command run cmake in script mode on that file.
This will let you be cross-platform in a good way.
--
Ryan Pavlik
Human-Computer Interaction Graduate Student
Virtual Reality Applications Center
Iowa State University
[email protected]
http://academic.cleardefinition.com/
_______________________________________________
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