MantisBT - CMake | ||||||||||
View Issue Details | ||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||
0013567 | CMake | CMake | public | 2012-10-02 07:25 | 2013-03-04 08:38 | |||||
Reporter | JussiP | |||||||||
Assigned To | ||||||||||
Priority | normal | Severity | feature | Reproducibility | always | |||||
Status | closed | Resolution | duplicate | |||||||
Platform | Linux | OS | Linux | OS Version | Any | |||||
Product Version | CMake 2.8.9 | |||||||||
Target Version | Fixed in Version | |||||||||
Summary | 0013567: Add functionality to help users write precompiled header support | |||||||||
Description | This bug is not a request for general precompiled header support, but rather a request for some additional functionality to make writing that support easier. To use precompiled headers with gcc, they must be compiled like this: g++ [every single flag and option that would be given to source files] header.h -o header.h.gch Those flags include stuff like -fPIC, -D flags and so on. If any one of them is missing, the produced file will not work. Currently in CMake this list of flags is really hard to get to. There are two choices that I can see. 1) add a function to CMake that gives all command line switches for a given target. Then it could be used to build the pch like this ----- get_all_switches_for_target(switches targetname) list(APPEND switches ${pch_file} -o ${CMAKE_CURRENT_BINARY_DIR}/${pch_file}.gch) add_custom_command(... ----- 2) If you add the header to the list of source files and then do this: set_property(SOURCE precompiled.h PROPERTY LANGUAGE CXX) then CMake will build the pch correctly, but it will be called precompiled.o. GCC will not use it in this case. If there were an additional property which would allow the user to set the output file name (and tell CMake not to link the resulting object file in the target), then the pch could be generated and used easily. The difference between the two is that the latter would automatically be part of dependency tracking. This is only an issue if you want to precompile your own headers. Most projects only use precompiled headers for system headers, such as STL, Boost and Qt. | |||||||||
Steps To Reproduce | ||||||||||
Additional Information | ||||||||||
Tags | No tags attached. | |||||||||
Relationships |
| |||||||||
Attached Files | ||||||||||
Issue History | ||||||||||
Date Modified | Username | Field | Change | |||||||
2012-10-02 07:25 | JussiP | New Issue | ||||||||
2012-10-02 08:01 | Brad King | Relationship added | duplicate of 0001260 | |||||||
2012-10-02 08:02 | Brad King | Note Added: 0031148 | ||||||||
2012-10-02 08:02 | Brad King | Status | new => resolved | |||||||
2012-10-02 08:02 | Brad King | Resolution | open => duplicate | |||||||
2013-03-04 08:38 | Robert Maynard | Note Added: 0032464 | ||||||||
2013-03-04 08:38 | Robert Maynard | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|