[CMake] ADD_CUSTOM_COMMAND Application dependency

Lars laasunde at hotmail.com
Wed Nov 19 05:14:07 EST 2014




 The below example build "App" and copies it to EXECUTABLE_OUTPUT_PATH.
ADD_EXECUTABLE(App ${source})
TARGET_LINK_LIBRARIES(App ${lib1} ${lib2})
INSTALL(TARGETS App ..)
The top level CMakeLists.txt has install directives for lib1 and lib2
INSTALL(FILES ${lib1}/bin/lib1.dll DESTINATION ...)
INSTALL(FILES ${lib2}/bin/lib2.dll DESTINATION ...)
Later in the build process we would like to use "App"
ADD_CUSTOM_COMMAND(OUTPUT "${src} COMMAND App ...)
The ADD_CUSTOM_COMMAND command currently fails because lib1 and lib2 are not present in EXECUTABLE_OUTPUT_PATH.
The following solutions work but are not desirable approaches:
 - Copying the necessary files to EXECUTABLE_OUTPUT_PATH via ADD_CUSTOM_COMMAND. This would be repeating top level install directives at target level.
 - Update "path" environment variable to include paths to lib1 and lib2 libraries.
What other options are available using CMake? Does ADD_CUSTOM_COMMAND have a way to update path environment prior to executing a command?
 

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141119/6dbda280/attachment-0001.html>


More information about the CMake mailing list