enable_language(CXX) file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$/somefile.cpp" CONTENT "static const char content[] = \"$\";\n" ) add_library(foo INTERFACE )