PCH: Unclear error when reusing precompiled headers from interface library
I use the following code to create an interface library with some precompiled headers:
function(ADD_ARROW_PRECOMPILED_HEADER_LIB LIB_NAME HEADER)
add_library(${LIB_NAME} INTERFACE)
if(ARROW_USE_PRECOMPILED_HEADERS)
target_precompile_headers(${LIB_NAME} INTERFACE ${HEADER})
endif()
endfunction()
add_arrow_precompiled_header_lib(arrow_pch "$<$<COMPILE_LANGUAGE:CXX>:arrow/pch.h>")
Then I'm trying to reuse the precompiled headers in an actual library:
target_precompile_headers(arrow_objlib REUSE_FROM arrow_pch)
But that fails with the following errors:
CMake Error at cmake_modules/BuildUtils.cmake:208 (target_precompile_headers):
INTERFACE_LIBRARY targets may only have whitelisted properties. The
property "COMPILE_PDB_NAME" is not allowed.
Call Stack (most recent call first):
src/arrow/CMakeLists.txt:353 (add_arrow_lib)
CMake Error at cmake_modules/BuildUtils.cmake:208 (target_precompile_headers):
INTERFACE_LIBRARY targets may only have whitelisted properties. The
property "COMPILE_PDB_OUTPUT_DIRECTORY" is not allowed.
Call Stack (most recent call first):
src/arrow/CMakeLists.txt:353 (add_arrow_lib)
This is with CMake 3.16.3 on Ubuntu 18.04. I don't understand the error at all, but it seems it may be related to #17640 (closed).
Edited by Brad King