View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0014404 | CMake | CMake | public | 2013-09-12 21:13 | 2014-03-05 09:58 | ||||
Reporter | Cedric Perthuis | ||||||||
Assigned To | |||||||||
Priority | high | Severity | feature | Reproducibility | always | ||||
Status | closed | Resolution | no change required | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake 2.8.11.2 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0014404: custom build rule for files in visual studio project | ||||||||
Description | Hi, I would like a way to define a true custom build rule for files in visual studio projects. For example, I would like to add to the project a file called myAsset.def and defines a custom build rule to compile it which would be to call a python script called asset_generator.py. The closest I got with cmake so far is to use a custom_command with myAsset.def in input and myAsset.h in output and add myAsset.h to the project. This adds to the project: 1 - CMake_Rules/myAsset.def.rule 2 - myAsset.h 3 - myAsset.def 1: this file has a custom build rule contains the call to asset_generator.py. I don't want to see this extra file showing up in my project. 2: this is the output of the custom command, I don't want to see it in the project either. I had to name it a .h file because else the whole rule is skipped. 3: this is my source, this is what I want to see in the project. It doesn't have any custom build rule set to it. But I would like to have the custom build rule define on it. So here's what I would suggest: 1) a new property called FILE in add_custom_command: add_custom_command( FILE myAsset.def COMMAND python ARGS ${abs_script} ${abs_infile} ${abs_outfile} DEPENDS ${infile} VERBATIM) 2) add_executable / add_library would let me pass "myAsset.def" and it would show up properly in the project with the build rule set on it. 3) On other platforms, the current behavior is fine, I don't know about xcode, if it supports custom build rule like visual, it'd be nice to also support it there. Note: The input and output files from the custom build rule will be automatically discovered by Visual studio (2010 and above). So what I describe above is really all we're missing, we don't need any complicated dependency system. On other platforms, we will probably use a different mechanism and stick with the current add_custom_command. This is somewhat critical for the projects we plan on using cmake for. GYP supports this, and that might tilt the balance in favor of GYP for us. Thanks. | ||||||||
Steps To Reproduce | macro(add_asset infile) get_filename_component(outfile ${infile} NAME_WE) set(outfilepath "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/asset_${outfile}.h") get_filename_component(abs_outfile ${outfilepath} ABSOLUTE) get_filename_component(abs_infile ${infile} ABSOLUTE) get_filename_component(abs_script ${MAIN_DIR}/build/asset_generator.py ABSOLUTE) add_custom_command(OUTPUT ${outfilepath} COMMAND python ARGS ${abs_script} ${abs_infile} ${abs_outfile} DEPENDS ${infile} VERBATIM) set (asset_sources ${asset_sources} ${infile} ${abs_outfile}) endmacro() add_asset(myAsset.def) add_executable(myExe main.cpp ${asset_sources}) | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0033815) Brad King (manager) 2013-09-13 08:20 |
Use the MAIN_DEPENDENCY option. Please bring questions like this up on the mailing list before assuming it is a bug or missing feature. |
(0035257) Robert Maynard (manager) 2014-03-05 09:58 |
Closing resolved issues that have not been updated in more than 4 months |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2013-09-12 21:13 | Cedric Perthuis | New Issue | |
2013-09-13 08:20 | Brad King | Note Added: 0033815 | |
2013-09-13 08:20 | Brad King | Status | new => resolved |
2013-09-13 08:20 | Brad King | Resolution | open => no change required |
2014-03-05 09:58 | Robert Maynard | Note Added: 0035257 | |
2014-03-05 09:58 | Robert Maynard | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |