Add Visual C++ property sheets using CMake

后端 未结 3 1741
独厮守ぢ
独厮守ぢ 2021-02-18 19:07

I\'m currently porting a gcc project to Visual C++. It\'s defined in a CMake file, and I have created a Visual C++ property sheet to aid in compatibility (GccCompat.props). Ever

3条回答
  •  花落未央
    2021-02-18 19:30

    This functionality has made it into the nightly build of CMake (https://gitlab.kitware.com/cmake/cmake/commit/e390991846825799e619e072a28f1da58b7c89ba), although not into a stable release yet. Theoretically, it will be in the next release, and CMake releases are made relatively frequently.

    To use, you would set the VS_USER_PROPS property on a target. Eg. set_target_properties(foo PROPERTIES VS_USER_PROPS "${props_file}").

    However, it doesn't appear that you can use multiple property sheets with this option, and, it replaces the default user property file ($(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props). To workaround this, property sheets can include other property sheets, so, you could make a 'master' property sheet which includes any other property sheets that you would like to use (including the default user property sheet).

提交回复
热议问题