Reputation: 11640
I'm trying to customize a lib installed through vcpkg with regular CMake commands. The only thing I need to tweak is to enable a preprocessor, e.g., BUILD_WITH_THIS_OPTINAL_FEATURE.
With Visual Studio, it's pretty straightforward: Just add it to the C/C++ > Preprocessor
property of the project. But with vcpkg, it's unclear how to mix it with its own functions.
Say if I have a portfile ready under
E:\_dev\vcpkg\ports\mylib\portfile.cmake
I'd really love to let it know that I want to
add_compile_definitions(BUILD_WITH_THIS_OPTINAL_FEATURE)
But doing so directly in portfile.cmake
gives me
CMake Error at ports/mylib/portfile.cmake:38 (add_compile_definitions):
Unknown CMake command "add_compile_definitions".
Anyone knows how?
Upvotes: 2
Views: 765
Reputation: 11640
Solved it myself.
I just need to add the following to vcpkg_configure_cmake
's OPTIONS
input arg
-DBUILD_WITH_THIS_OPTINAL_FEATURE=ON
Upvotes: 3