Условия для предкомпиляции заголовков

This commit is contained in:
Andrei Astafev 2022-10-04 11:51:24 +03:00
parent 79c12f1827
commit 0a63e8a6b5

View File

@ -36,7 +36,7 @@ function(myx_target_setup NAME)
endif()
if(ARG_PCH)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16 AND PROJECT_IS_TOP_LEVEL OR MYX_USE_LOCAL_DIRECTORIES)
target_precompile_headers(${NAME} PRIVATE ${ARG_PCH})
else()
target_compile_options(${NAME} PRIVATE -include ${ARG_PCH})