# Header-only libs and VStudio Generator?

**URL:** https://discourse.cmake.org/t/header-only-libs-and-vstudio-generator/3755
**Category:** Usage
**Created:** [July 14, 2021, 1:11pm UTC](https://discourse.cmake.org/t/header-only-libs-and-vstudio-generator/3755 "2021-07-14T13:11:14Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![llm](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/7ba0ec/32.png) [@llm](https://discourse.cmake.org/u/llm)
#### Post date: [July 14, 2021, 1:11pm UTC](https://discourse.cmake.org/t/header-only-libs-and-vstudio-generator/3755/1 "2021-07-14T13:11:14Z")

</div>

i’ve tried to add a header-only lib project to my VStudio 2017  
using latest CMake Release 3.20.5 under Win7 x64 in a x64 C++ Projekt

using the tutorial here:  
[http://mariobadr.com/creating-a-header-only-library-with-cmake.html](http://mariobadr.com/creating-a-header-only-library-with-cmake.html)

my CMakeLists.txt works - no errors etc. but it seems that no Studio project  
gets generated

according to Issues (18491, 18608) there were some problems - but all seem to be fixed

still, i don’t see a project for my lib in VStudio, nor is anything generated

is there a small working example around or are there still open issues to fix to get that working?

Hierarchy:

this tryout generates a project but the add\_custom\_target seems not to be clear/pure CMake style

```auto
cmake_header_only_dev\__build
cmake_header_only_dev\cmake_header_only
cmake_header_only_dev\cmake_header_only\CMakeLists.txt
  cmake_minimum_required (VERSION 3.19)
  project (my_header_only_lib)
  add_subdirectory (header_only)
      
cmake_header_only_dev\cmake_header_only\header_only
cmake_header_only_dev\cmake_header_only\header_only\CMakeLists.txt
  #target_sources(header_only INTERFACE test.hpp)
  if(MSVC)
    add_custom_target(header_only SOURCES test.hpp)
  endif()
  #add_library(header_only INTERFACE)

cmake_header_only_dev\cmake_header_only\header_only\test.hpp

```
