title: cmake error for header-only library: `include could not find load file`
body: <p>I've been trying to change a makefile c++ project into a cmake project, and I've been having som difficulty. <code>cmake</code> seems to be looking for stuff in <code>/usr/local/lib/</code> instead of <code>/usr/local/include/</code> and I'm not sure why that is.</p>
  <p>This library is header-only, and so I've been following <a href="https://dominikberner.ch/cmake-interface-lib/" rel="nofollow noreferrer">this tutorial</a> My header-only library in <code>include</code> seems to &quot;build&quot; fine, but I keep getting the following error when I try to generate a makefile to build my example program:</p>
  <pre><code>me:~/pf/examples/build$ cmake ..
  -- The C compiler identification is GNU 7.5.0
  -- The CXX compiler identification is GNU 7.5.0
  -- Check for working C compiler: /usr/bin/cc
  -- Check for working C compiler: /usr/bin/cc - works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Check for working CXX compiler: /usr/bin/c++
  -- Check for working CXX compiler: /usr/bin/c++ - works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  CMake Error at /usr/local/lib/cmake/pf/pfConfig.cmake:27 (include):
    include could not find load file:
  
      /usr/local/lib/cmake/pf/pf_exampleTargets.cmake
  Call Stack (most recent call first):
    CMakeLists.txt:15 (find_package)
  </code></pre>
  <p><code>examples/CMakeLists.txt</code> creates another fresh project:</p>
  <pre><code>project(pf_example)
  
  cmake_minimum_required (VERSION 3.12)
  
  if(NOT CMAKE_BUILD_TYPE)
      set(CMAKE_BUILD_TYPE Release)
  endif()
  
  set(CMAKE_CXX_FLAGS &quot;-Wall -Wextra&quot;)
  set(CMAKE_CXX_FLAGS_DEBUG &quot;-g&quot;)
  set(CMAKE_CXX_FLAGS_RELEASE &quot;-O3&quot;)
  set(CMAKE_CXX_STANDARD 17)
  
  # &quot;install&quot; pf
  find_package(pf CONFIG REQUIRED)
  find_package(Eigen3 3.3 REQUIRED NO_MODULE)
  
  file(GLOB SOURCES ${PROJECT_NAME}/*.{h,cpp})
  message(&quot;${SOURCES}&quot;)
  add_executable(${PROJECT_NAME} ${SOURCES})
  target_link_libraries(${PROJECT_NAME} pf::pf) 
  </code></pre>
  <p>The root directory <code>CMakeLists.txt</code> file is more complicated. It's the one that was adapted from the tutorial I mentioned above:</p>
  <pre><code>cmake_minimum_required(VERSION 3.12)
  
  project(&quot;pf&quot; VERSION 1.0.1
               DESCRIPTION &quot;A header only c++ template library for fast particle filtering.&quot;
               HOMEPAGE_URL &quot;https://github.com/tbrown122387/pf&quot;)
  
  include(GNUInstallDirs)
  
  add_library(${PROJECT_NAME} INTERFACE)
  
  target_include_directories(
    ${PROJECT_NAME}
    INTERFACE $&lt;BUILD_INTERFACE:${${PROJECT_NAME}_SOURCE_DIR}/include&gt;
              $&lt;INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}&gt;)
  
  target_compile_features(${PROJECT_NAME} INTERFACE cxx_std_17)
  
  
  install(TARGETS ${PROJECT_NAME}
          EXPORT ${PROJECT_NAME}_Targets
          ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
          LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
          RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
  
  include(CMakePackageConfigHelpers)
  write_basic_package_version_file(&quot;${PROJECT_NAME}ConfigVersion.cmake&quot;
                                   VERSION ${PROJECT_VERSION}
                                   COMPATIBILITY SameMajorVersion)
  
  
  configure_package_config_file(
    &quot;${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in&quot;
    &quot;${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake&quot;
    INSTALL_DESTINATION
    ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
  
  install(EXPORT ${PROJECT_NAME}_Targets
          FILE ${PROJECT_NAME}Targets.cmake
          NAMESPACE ${PROJECT_NAME}::
          DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
  
  
  install(FILES &quot;${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake&quot;
                &quot;${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake&quot;
          DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME}/cmake)
  
  install(DIRECTORY ${PROJECT_SOURCE_DIR}/include DESTINATION include)
  </code></pre>
  <p>To install this header only library, before I try to build the examples project, I typed the following commands into the command line:</p>
  <pre><code>cd ~/pf
  mkdir build
  cd build/
  cmake .. -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/include
  sudo cmake --build . --config Release --target install -- -j $(nproc)
  </code></pre>
  <p>I didn't post it, but there's also a file <code>cmake/pfconfig.cmake.in</code> that is verbatim copied from the tutorial above.</p>