Re: [CMake] Add Custom COmmand and CMAKE_CFG_INTDIR
On 01/04/2012 10:11 PM, Bill Hoffman wrote: > On 1/4/2012 4:03 PM, Michael Jackson wrote: >> I robbed this from the HDF5 project which does something very similar to >> what I am doing: >> >> SET (CMD ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${CFG_INIT}/H5detect${EXE_EXT}) >> >> That "seems" to at least point to the proper location. Now to get Visual >> Studio to actually execute the executable. > That is pretty old stuff... > > There are better ways to do that in CMake now: Especially if one possibly wants to use the RUNTIME_OUTPUT_NAME target property to make the executable's name differ from the target's name. > cmake --help-command add_custom_command > > > Arguments to COMMAND may use "generator expressions" with the syntax > "$<...>". Generator expressions are evaluted during build system > generation to produce information specific to each build > configuration. Valid expressions are: > > $ = configuration name > $= main file (.exe, .so.1.2, .a) > $ = file used to link (.a, .lib, .so) > $ = file with soname (.so.3) > > This should work: >COMMAND $ AFAIK, CMake examines the first argument after the COMMAND clause in ADD_CUSTOM_COMMAND() whether it denotes an executable target, i.e. COMMAND $ and COMMAND FilterWidgetCodeGen should be equivalent, shouldn't they? Besides, Mike, both above-noted variants establish target-level dependencies on the executable target following COMMAND for the targets which trigger the custom command; most certainly, this isn't done if one provides expressions like ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${CFG_INIT}/H5detect${EXE_EXT} for the COMMAND. Regards, Michael > -Bill > > > >> -- >> Mike Jackson >> >> On Jan 4, 2012, at 3:54 PM, clin...@elemtech.com wrote: >> >>> Have you tried excluding the ".exe" thing? I thought cmake did the right >>> thing for targets used in custom commands. >>> >>> Clint >>> >>> - Reply message - >>> From: "Michael Jackson" >>> Date: Wed, Jan 4, 2012 1:28 pm >>> Subject: [CMake] Add Custom COmmand and CMAKE_CFG_INTDIR >>> To: "cmake@cmake.org List" >>> >>> 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 -- 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] Add Custom COmmand and CMAKE_CFG_INTDIR
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
Re: [CMake] Add Custom COmmand and CMAKE_CFG_INTDIR
On Wed, Jan 4, 2012 at 7:14 PM, Bill Hoffman wrote: > On 1/4/2012 4:27 PM, Michael Jackson wrote: >> >> Thanks! The definitely fixed the issue for ALL the platforms. I guess >> I just have not been keeping up with all the additions to CMake. At >> what version was this syntax introduced? > > > Looks like about a year ago: > http://cmake.org/gitweb?p=cmake.git;a=commit;h=f0cdb6001b3e915fc0d9c1120165d49725440bbd > > committerBrad King > Wed, 15 Dec 2010 19:53:48 + (14:53 -0500) > > > -Bill > > -- > > 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 That commit references fixing http://public.kitware.com/Bug/view.php?id=11209 -- and if you view it with gitk, it agrees and says the commit precedes the tag "v2.8.4". 2.8.4 or later should have this capability. You should use 2.8.4 if it's not already higher than that in your cmake_minimum_required call. HTH, David -- 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] Add Custom COmmand and CMAKE_CFG_INTDIR
On 1/4/2012 4:27 PM, Michael Jackson wrote: Thanks! The definitely fixed the issue for ALL the platforms. I guess I just have not been keeping up with all the additions to CMake. At what version was this syntax introduced? Looks like about a year ago: http://cmake.org/gitweb?p=cmake.git;a=commit;h=f0cdb6001b3e915fc0d9c1120165d49725440bbd committerBrad King Wed, 15 Dec 2010 19:53:48 + (14:53 -0500) -Bill -- 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] Add Custom COmmand and CMAKE_CFG_INTDIR
Thanks! The definitely fixed the issue for ALL the platforms. I guess I just have not been keeping up with all the additions to CMake. At what version was this syntax introduced? -- Mike Jackson On Jan 4, 2012, at 4:11 PM, Bill Hoffman wrote: > On 1/4/2012 4:03 PM, Michael Jackson wrote: >> I robbed this from the HDF5 project which does something very similar to >> what I am doing: >> >> SET (CMD ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${CFG_INIT}/H5detect${EXE_EXT}) >> >> That "seems" to at least point to the proper location. Now to get Visual >> Studio to actually execute the executable. > That is pretty old stuff... > > There are better ways to do that in CMake now: > > cmake --help-command add_custom_command > > > Arguments to COMMAND may use "generator expressions" with the syntax > "$<...>". Generator expressions are evaluted during build system > generation to produce information specific to each build > configuration. Valid expressions are: > > $ = configuration name > $= main file (.exe, .so.1.2, .a) > $ = file used to link (.a, .lib, .so) > $ = file with soname (.so.3) > > This should work: > COMMAND $ > > -Bill > > > >> -- >> Mike Jackson >> >> On Jan 4, 2012, at 3:54 PM, clin...@elemtech.com wrote: >> >>> Have you tried excluding the ".exe" thing? I thought cmake did the right >>> thing for targets used in custom commands. >>> >>> Clint >>> >>> - Reply message - >>> From: "Michael Jackson" >>> Date: Wed, Jan 4, 2012 1:28 pm >>> Subject: [CMake] Add Custom COmmand and CMAKE_CFG_INTDIR >>> To: "cmake@cmake.org List" >>> >>> 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 >>> ___ >>> Mike JacksonPrincipal Software Engineer >>> BlueQuartz SoftwareDayton, Ohio >>> mike.jack...@bluequartz.net www.bluequartz.net >>> -- 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] Add Custom COmmand and CMAKE_CFG_INTDIR
On 1/4/2012 4:03 PM, Michael Jackson wrote: I robbed this from the HDF5 project which does something very similar to what I am doing: SET (CMD ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${CFG_INIT}/H5detect${EXE_EXT}) That "seems" to at least point to the proper location. Now to get Visual Studio to actually execute the executable. That is pretty old stuff... There are better ways to do that in CMake now: cmake --help-command add_custom_command Arguments to COMMAND may use "generator expressions" with the syntax "$<...>". Generator expressions are evaluted during build system generation to produce information specific to each build configuration. Valid expressions are: $ = configuration name $= main file (.exe, .so.1.2, .a) $ = file used to link (.a, .lib, .so) $ = file with soname (.so.3) This should work: COMMAND $ -Bill -- Mike Jackson On Jan 4, 2012, at 3:54 PM, clin...@elemtech.com wrote: Have you tried excluding the ".exe" thing? I thought cmake did the right thing for targets used in custom commands. Clint - Reply message - From: "Michael Jackson" Date: Wed, Jan 4, 2012 1:28 pm Subject: [CMake] Add Custom COmmand and CMAKE_CFG_INTDIR To: "cmake@cmake.org List" 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 ___ Mike JacksonPrincipal Software Engineer BlueQuartz SoftwareDayton, Ohio mike.jack...@bluequartz.net www.bluequartz.net -- 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 -- Bill Hoffman Kitware, Inc. 28 Corporate Drive Clifton Park, NY 12065 bill.hoff...@kitware.com http://www.kitware.com 518 881-4905 (Direct) 518 371-3971 x105 Fax (518) 371-4573 -- 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] Add Custom COmmand and CMAKE_CFG_INTDIR
I robbed this from the HDF5 project which does something very similar to what I am doing: SET (CMD ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${CFG_INIT}/H5detect${EXE_EXT}) That "seems" to at least point to the proper location. Now to get Visual Studio to actually execute the executable. -- Mike Jackson On Jan 4, 2012, at 3:54 PM, clin...@elemtech.com wrote: > Have you tried excluding the ".exe" thing? I thought cmake did the right > thing for targets used in custom commands. > > Clint > > - Reply message - > From: "Michael Jackson" > Date: Wed, Jan 4, 2012 1:28 pm > Subject: [CMake] Add Custom COmmand and CMAKE_CFG_INTDIR > To: "cmake@cmake.org List" > > 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 > ___ > Mike JacksonPrincipal Software Engineer > BlueQuartz SoftwareDayton, Ohio > mike.jack...@bluequartz.net www.bluequartz.net > > -- > > 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] Add Custom COmmand and CMAKE_CFG_INTDIR
Have you tried excluding the ".exe" thing? I thought cmake did the right thing for targets used in custom commands. Clint - Reply message - From: "Michael Jackson" Date: Wed, Jan 4, 2012 1:28 pm Subject: [CMake] Add Custom COmmand and CMAKE_CFG_INTDIR To: "cmake@cmake.org List" 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 ___ Mike JacksonPrincipal Software Engineer BlueQuartz SoftwareDayton, Ohio mike.jack...@bluequartz.net www.bluequartz.net -- 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
[CMake] Add Custom COmmand and CMAKE_CFG_INTDIR
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 ___ Mike JacksonPrincipal Software Engineer BlueQuartz SoftwareDayton, Ohio mike.jack...@bluequartz.net www.bluequartz.net -- 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