aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormyd7349 <myd7349@gmail.com>2019-06-29 23:29:13 +0800
committerCurtis J Bezault <curtbezault@gmail.com>2019-06-29 08:29:13 -0700
commita7bbee315276d37344a464eb95b02ca20ff1b0c2 (patch)
treef5e2e50b91aa575dd01ab758a92c3195f2f90a4f
parent62ed7c17318b4f46109c2de73b7584fb04e85720 (diff)
downloadvcpkg-a7bbee315276d37344a464eb95b02ca20ff1b0c2.tar.gz
vcpkg-a7bbee315276d37344a464eb95b02ca20ff1b0c2.zip
[vcpkg] Update vcpkg_check_features document (#7091)
* [oniguruma] Fix misusage of vcpkg_check_features * [xsimd] Use vcpkg_check_features
-rw-r--r--docs/maintainers/vcpkg_check_features.md48
-rw-r--r--ports/oniguruma/CONTROL2
-rw-r--r--ports/oniguruma/portfile.cmake6
-rw-r--r--ports/xsimd/CONTROL3
-rw-r--r--ports/xsimd/portfile.cmake8
-rw-r--r--scripts/cmake/vcpkg_check_features.cmake48
6 files changed, 88 insertions, 27 deletions
diff --git a/docs/maintainers/vcpkg_check_features.md b/docs/maintainers/vcpkg_check_features.md
index ca2debf85..46ee9051a 100644
--- a/docs/maintainers/vcpkg_check_features.md
+++ b/docs/maintainers/vcpkg_check_features.md
@@ -1,6 +1,6 @@
# vcpkg_check_features
-Check if one or more features are part of the package installation.
+Check if one or more features are a part of the package installation.
## Usage
```cmake
@@ -11,12 +11,9 @@ vcpkg_check_features(
)
```
-`vcpkg_check_features` accepts a list of (feature, output_variable) pairs.
-The syntax is similar to the `PROPERTIES` argument of `set_target_properties`.
+`vcpkg_check_features` accepts a list of (feature, output_variable) pairs. If a feature is specified, the corresponding output variable will be set as `ON`, or `OFF` otherwise. The syntax is similar to the `PROPERTIES` argument of `set_target_properties`.
-`vcpkg_check_features` will create a variable `FEATURE_OPTIONS` in the
-parent scope, which you can pass as a part of `OPTIONS` argument when
-calling functions like `vcpkg_config_cmake`:
+`vcpkg_check_features` will create a variable `FEATURE_OPTIONS` in the parent scope, which you can pass as a part of `OPTIONS` argument when calling functions like `vcpkg_config_cmake`:
```cmake
vcpkg_config_cmake(
SOURCE_PATH ${SOURCE_PATH}
@@ -28,13 +25,46 @@ vcpkg_config_cmake(
```
## Notes
-`vcpkg_check_features` is supposed to be called only once. Otherwise, the
-`FEATURE_OPTIONS` variable set by a previous call will be overwritten.
+```cmake
+vcpkg_check_features(<feature> <output_variable>)
+```
+can be used as a replacement of:
+```cmake
+if(<feature> IN_LIST FEATURES)
+ set(<output_variable> ON)
+else()
+ set(<output_variable> OFF)
+endif()
+```
+
+However, if you have a feature that was checked like this before:
+```cmake
+if(<feature> IN_LIST FEATURES)
+ set(<output_variable> OFF)
+else()
+ set(<output_variable> ON)
+endif()
+```
+then you should not use `vcpkg_check_features` instead. [```oniguruma```](https://github.com/microsoft/vcpkg/blob/master/ports/oniguruma/portfile.cmake), for example, has a feature named `non-posix` which is checked with:
+```cmake
+if("non-posix" IN_LIST FEATURES)
+ set(ENABLE_POSIX_API OFF)
+else()
+ set(ENABLE_POSIX_API ON)
+endif()
+```
+and by replacing these code with:
+```cmake
+vcpkg_check_features(non-posix ENABLE_POSIX_API)
+```
+is totally wrong.
+
+`vcpkg_check_features` is supposed to be called only once. Otherwise, the `FEATURE_OPTIONS` variable set by a previous call will be overwritten.
## Examples
* [czmq](https://github.com/microsoft/vcpkg/blob/master/ports/czmq/portfile.cmake)
-* [oniguruma](https://github.com/microsoft/vcpkg/blob/master/ports/oniguruma/portfile.cmake)
+* [xsimd](https://github.com/microsoft/vcpkg/blob/master/ports/xsimd/portfile.cmake)
* [xtensor](https://github.com/microsoft/vcpkg/blob/master/ports/xtensor/portfile.cmake)
## Source
diff --git a/ports/oniguruma/CONTROL b/ports/oniguruma/CONTROL
index 7eb4e6173..768083b4e 100644
--- a/ports/oniguruma/CONTROL
+++ b/ports/oniguruma/CONTROL
@@ -1,5 +1,5 @@
Source: oniguruma
-Version: 6.9.2-1
+Version: 6.9.2-2
Description: Modern and flexible regular expressions library
Homepage: https://github.com/kkos/oniguruma
diff --git a/ports/oniguruma/portfile.cmake b/ports/oniguruma/portfile.cmake
index 28f489926..586bfbe07 100644
--- a/ports/oniguruma/portfile.cmake
+++ b/ports/oniguruma/portfile.cmake
@@ -8,7 +8,11 @@ vcpkg_from_github(
HEAD_REF master
)
-vcpkg_check_features(non-posix ENABLE_POSIX_API)
+if("non-posix" IN_LIST FEATURES)
+ set(ENABLE_POSIX_API OFF)
+else()
+ set(ENABLE_POSIX_API ON)
+endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
diff --git a/ports/xsimd/CONTROL b/ports/xsimd/CONTROL
index 05241ac5e..6147d355c 100644
--- a/ports/xsimd/CONTROL
+++ b/ports/xsimd/CONTROL
@@ -1,6 +1,7 @@
Source: xsimd
-Version: 7.2.3
+Version: 7.2.3-1
Description: Modern, portable C++ wrappers for SIMD intrinsics
+Homepage: https://github.com/QuantStack/xsimd
Feature: xcomplex
Description: xtl complex support
diff --git a/ports/xsimd/portfile.cmake b/ports/xsimd/portfile.cmake
index a25bcb532..338afff45 100644
--- a/ports/xsimd/portfile.cmake
+++ b/ports/xsimd/portfile.cmake
@@ -5,16 +5,12 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO QuantStack/xsimd
- REF 7.2.3
+ REF 7.2.3
SHA512 fb34eeb585f6820499734f10f03a4efd0d9a9b4be56f9bee21f3564eb92be56e7abe7682e476fafaff4733939f33f91cb4ab9209140b19f7b740538853433532
HEAD_REF master
)
-if("xcomplex" IN_LIST FEATURES)
- set(ENABLE_XTL_COMPLEX ON)
-else()
- set(ENABLE_XTL_COMPLEX OFF)
-endif()
+vcpkg_check_features(xcomplex ENABLE_XTL_COMPLEX)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
diff --git a/scripts/cmake/vcpkg_check_features.cmake b/scripts/cmake/vcpkg_check_features.cmake
index c8848e987..115b1501f 100644
--- a/scripts/cmake/vcpkg_check_features.cmake
+++ b/scripts/cmake/vcpkg_check_features.cmake
@@ -1,6 +1,6 @@
## # vcpkg_check_features
##
-## Check if one or more features are part of the package installation.
+## Check if one or more features are a part of the package installation.
##
## ## Usage
## ```cmake
@@ -11,12 +11,9 @@
## )
## ```
##
-## `vcpkg_check_features` accepts a list of (feature, output_variable) pairs.
-## The syntax is similar to the `PROPERTIES` argument of `set_target_properties`.
+## `vcpkg_check_features` accepts a list of (feature, output_variable) pairs. If a feature is specified, the corresponding output variable will be set as `ON`, or `OFF` otherwise. The syntax is similar to the `PROPERTIES` argument of `set_target_properties`.
##
-## `vcpkg_check_features` will create a variable `FEATURE_OPTIONS` in the
-## parent scope, which you can pass as a part of `OPTIONS` argument when
-## calling functions like `vcpkg_config_cmake`:
+## `vcpkg_check_features` will create a variable `FEATURE_OPTIONS` in the parent scope, which you can pass as a part of `OPTIONS` argument when calling functions like `vcpkg_config_cmake`:
## ```cmake
## vcpkg_config_cmake(
## SOURCE_PATH ${SOURCE_PATH}
@@ -28,13 +25,46 @@
## ```
##
## ## Notes
-## `vcpkg_check_features` is supposed to be called only once. Otherwise, the
-## `FEATURE_OPTIONS` variable set by a previous call will be overwritten.
+## ```cmake
+## vcpkg_check_features(<feature> <output_variable>)
+## ```
+## can be used as a replacement of:
+## ```cmake
+## if(<feature> IN_LIST FEATURES)
+## set(<output_variable> ON)
+## else()
+## set(<output_variable> OFF)
+## endif()
+## ```
+##
+## However, if you have a feature that was checked like this before:
+## ```cmake
+## if(<feature> IN_LIST FEATURES)
+## set(<output_variable> OFF)
+## else()
+## set(<output_variable> ON)
+## endif()
+## ```
+## then you should not use `vcpkg_check_features` instead. [```oniguruma```](https://github.com/microsoft/vcpkg/blob/master/ports/oniguruma/portfile.cmake), for example, has a feature named `non-posix` which is checked with:
+## ```cmake
+## if("non-posix" IN_LIST FEATURES)
+## set(ENABLE_POSIX_API OFF)
+## else()
+## set(ENABLE_POSIX_API ON)
+## endif()
+## ```
+## and by replacing these code with:
+## ```cmake
+## vcpkg_check_features(non-posix ENABLE_POSIX_API)
+## ```
+## is totally wrong.
+##
+## `vcpkg_check_features` is supposed to be called only once. Otherwise, the `FEATURE_OPTIONS` variable set by a previous call will be overwritten.
##
## ## Examples
##
## * [czmq](https://github.com/microsoft/vcpkg/blob/master/ports/czmq/portfile.cmake)
-## * [oniguruma](https://github.com/microsoft/vcpkg/blob/master/ports/oniguruma/portfile.cmake)
+## * [xsimd](https://github.com/microsoft/vcpkg/blob/master/ports/xsimd/portfile.cmake)
## * [xtensor](https://github.com/microsoft/vcpkg/blob/master/ports/xtensor/portfile.cmake)
function(vcpkg_check_features)
cmake_parse_arguments(_vcf "" "" "" ${ARGN})