I have the following: cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) project(foo) add_library(foo INTERFACE) target_sources(foo INTERFACE foo.h) add_subdirectory(subdir)
And inside subdir, I specify add_executable() and then target_link_libraries(myexe foo). I get an error: Cannot find source file: foo.h I'm using CMake 3.6. What am I doing wrong here? My goal is to generate a header-only project in Visual Studio. According to the documentation, what I'm trying to do won't give me that. Instead, foo.h would exist in every project that links to it as a dependency (that's what it seems like anyhow). Advice is appreciated. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake