On 01/04/2012 09:28 PM, Michael Jackson wrote: > I am having trouble getting add_custom_Command and CMAKE_CFG_INTDIR to work > correctly together. This is what I have so far. > > # ---------- Setup output Directories ------------------------- > SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY > ${PROJECT_BINARY_DIR}/Bin > CACHE PATH > "Single Directory for all Libraries" > ) > > # Create our custom executable that will generate most of our QFilterWidget > # classes from information stored in the Filters themselves. > configure_file( ${FilterWidgets_SOURCE_DIR}/CodeGen.cpp.in > ${FilterWidgets_BINARY_DIR}/FilterWidgetCodeGen.cpp) > add_executable(FilterWidgetCodeGen > ${FilterWidgets_BINARY_DIR}/FilterWidgetCodeGen.cpp) > target_link_libraries(FilterWidgetCodeGen MXA EbsdLib DREAM3DLib) > set(EXE_EXTENSION "") > if (WIN32) > set (EXE_EXTENSION ".exe") > endif() > # Now run the code to generate the header files which will over write the > place > # holder files that were generated from above > add_custom_command(TARGET FilterWidgetCodeGen POST_BUILD > COMMAND FilterWidgetCodeGen${EXE_EXTENSION} > WORKING_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) > > > I know this is going to fail on visual studio, which it did. The issue is, > what combination of CMAKE_CFG_INTDIR and anything else do I use to get this > to work? > > Thanks
Hi AFAICS the only real problem is the EXE_EXTENSION. If you use a target name in add_custom_command, CMake will figure out the location and name of the actual executable on its own. By appending EXE_EXTENSION CMake won't be able to recognize the target name any more, and just run the command as you specified it. In this case you would need to fiddle around with CMAKE_CFG_INTDIR, that's true. But since CMake is able to do it automagically, I think you shouldn't try to outsmart it. Another thing: I think you should use CMAKE_RUNTIME_OUTPUT_DIRECTORY instead of CMAKE_LIBRARY_OUTPUT_DIRECTORY. My 2c... Michael -- 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