enable_language(C) enable_language(CXX) add_executable(foobar foo.c main.cpp ) target_include_directories(foobar PUBLIC include) target_precompile_headers(foobar PRIVATE "$<$:${CMAKE_CURRENT_SOURCE_DIR}/include/foo_C.h>" "$<$:${CMAKE_CURRENT_SOURCE_DIR}/include/foo_CXX.h>" "$<$:>" "$<$:>" )