cmake-precompiled-header icon indicating copy to clipboard operation
cmake-precompiled-header copied to clipboard

Ninja build does not work if you have more than one lib/exe

Open bertubezz opened this issue 7 years ago • 2 comments

This is because with Ninja generator 'CMAKE_CFG_INTDIR' get resolves to '.' thus making all projects pointing to the same file which at this point in time it is not supported. one can use CMAKE_CURRENT_BINARY_DIR instead.

bertubezz avatar Nov 11 '17 23:11 bertubezz

There is a bug in setting the output path for the precompiled headers for visual studio. It should say

if(MSVC) set(pch_cxx_pch "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/cxx${_input_we}.pch") set(pch_c_pch "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/c${_input_we}.pch")

not set(pch_cxx_pch "${CMAKE_CFG_INTDIR}/cxx${_input_we}.pch") set(pch_c_pch "${CMAKE_CFG_INTDIR}/c${_input_we}.pch")

bubnikv avatar Oct 29 '18 16:10 bubnikv

This is indeed necessary for project that have multiple pch, but pch_cxx_pch is now _pch_cxx_pch:

    set(_pch_cxx_pch "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/cxx${_input_we}.pch")
    set(_pch_c_pch "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/c${_input_we}.pch")

sdebionne avatar Jan 31 '19 10:01 sdebionne