Note that there are some explanatory texts on larger screens.

plurals
  1. POCMake, Qt, gcc and precompiled headers
    primarykey
    data
    text
    <p>I'm (once again) struggling with the creation of precompiled headers in conjunction with gcc and Qt on the Apple platform.</p> <p>When now creating my precompiled header I use a code section (based on good old "PCHSupport_26.cmake") to extract the compile flags as follows:</p> <pre><code>STRING(TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name) SET(_args ${CMAKE_CXX_FLAGS} ${${_flags_var_name}}) GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES ) FOREACH(_item ${DIRINC}) LIST(APPEND _args "-I${_item}") ENDFOREACH(_item) GET_DIRECTORY_PROPERTY(_defines_global COMPILE_DEFINITIONS) LIST(APPEND defines ${_defines_global}) STRING(TOUPPER "COMPILE_DEFINITIONS_${CMAKE_BUILD_TYPE}" _defines_for_build_name) GET_DIRECTORY_PROPERTY(defines_build ${_defines_for_build_name}) LIST(APPEND _defines ${_defines_build}) FOREACH(_item ${_defines}) LIST(APPEND _args "-D${_item}") ENDFOREACH(_item ${_defines}) LIST(APPEND _args -c ${CMAKE_CURRENT_SOURCE_DIR}/${PRECOMPILED_HEADER} -o ${_gch_filename}) SEPARATE_ARGUMENTS(_args) </code></pre> <p>Unfortunately the above compiler flags miss two important parameter that CMake does generate when using the build-in compiler rules: <code>-DQT_DEBUG</code> and when compiling with the generated precompiled header, I get errors as follows: file.h: not used because <code>QT_DEBUG</code> is defined.</p> <p>I would need your help with the following:</p> <ol> <li>Is the above way to retrieve the compiler flags correct ?</li> <li>Is there a better, easier, simpler way to do this ?</li> <li>Why does <code>-DQT_DEBUG</code> not show up in <code>COMPILE_DEFINITIONS</code> or <code>COMPILE_DEFINITIONS_${CMAKE_BUILD_TYPE}</code></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload