# Missing CompileAs option on vcxproj generated by cmake 3.18.1

**URL:** <https://discourse.cmake.org/t/missing-compileas-option-on-vcxproj-generated-by-cmake-3-18-1/1708>\
**Category:** Code\
**Tags:** os:windows, gen:vs\
**Created:** [August 14, 2020, 12:08pm UTC](https://discourse.cmake.org/t/missing-compileas-option-on-vcxproj-generated-by-cmake-3-18-1/1708 "2020-08-14T12:08:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![YassinLokhat](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/y/34f0e0/32.png) [@YassinLokhat](https://discourse.cmake.org/u/YassinLokhat)\
**Post date:** [August 14, 2020, 12:08pm UTC](https://discourse.cmake.org/t/missing-compileas-option-on-vcxproj-generated-by-cmake-3-18-1/1708/1 "2020-08-14T12:08:44Z")

</div>

When I generate the .vcxproj for my project with cmake 3.2.1, it generates the line `<CompileAs>CompileAsCpp</CompileAs>` But when I try the cmake version 3.18.1, the generated .vcxproj file does not contain that previous line causing my tests to fail (the code compiles). Here the cmake code which set the project properties :

```
add_library(${PROJECT_NAME} SHARED ${PROJECT_SRC})

if(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake|MSBuild)")
    target_compile_options(${PROJECT_NAME} PRIVATE "/TP")
endif()

target_include_directories(${PROJECT_NAME} PRIVATE ${PUBLIC_INCLUDES} ${PRIVATE_INCLUDES} )
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${PROJECT_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${PROJECT_NAME} PROPERTIES PDB_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

```

How can I ask to cmake to generate that missing line ( `<CompileAs>CompileAsCpp</CompileAs>` )? Thank you.

---

<div class="post-metadata">

**Author:** ![YassinLokhat](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/y/34f0e0/32.png) [@YassinLokhat](https://discourse.cmake.org/u/YassinLokhat)\
**Post date:** [August 26, 2020, 11:54am UTC](https://discourse.cmake.org/t/missing-compileas-option-on-vcxproj-generated-by-cmake-3-18-1/1708/2 "2020-08-26T11:54:25Z")

</div>

I tried to use CMake 3.18.0 and it worked. The CompileAs tag was generated so I will use this version instead of the CMake 3.18.1

Thank you.

---

<div class="post-metadata">

**Author:** ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Post date:** [August 26, 2020, 9:33pm UTC](https://discourse.cmake.org/t/missing-compileas-option-on-vcxproj-generated-by-cmake-3-18-1/1708/3 "2020-08-26T21:33:36Z")

</div>

Sounds like that is a regression. Could you please report this in the CMake issue tracker?

[https://gitlab.kitware.com/cmake/cmake/-/issues](https://gitlab.kitware.com/cmake/cmake/-/issues)
