Skip to content

Commit

Permalink
on_contract_violation default None
Browse files Browse the repository at this point in the history
  • Loading branch information
perseoGI committed Sep 6, 2024
1 parent 67f7f46 commit ff011a8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions recipes/gsl-lite/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os

from conan import ConanFile
from conan.tools.files import get, copy
from conan.tools.files import copy, get
from conan.tools.layout import basic_layout
import os

required_conan_version = ">=1.50.0"

Expand All @@ -23,11 +24,12 @@ class GslLiteConan(ConanFile):
# 2. GSL_THROW_ON_CONTRACT_VIOLATION: a gsl::fail_fast exception will be thrown
# 3. GSL_UNENFORCED_ON_CONTRACT_VIOLATION: nothing happens
#
options = {
"on_contract_violation": ["terminate", "throw", "unenforced", "None"]
}
options = {"on_contract_violation": [None, "terminate", "throw", "unenforced"]}
default_options = {
"on_contract_violation": "terminate",
"on_contract_violation": None,
}
options_description = {
"on_contract_violation": "Select the behavior when pre/post conditions on the GSL types are violated"
}

no_copy_source = True
Expand Down Expand Up @@ -59,7 +61,7 @@ def package_info(self):
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []
# TODO: back to global scope in conan v2 once cmake_find_package* generators removed
if self.options.on_contract_violation != "None":
if self.options.on_contract_violation:
self.cpp_info.components["gsllite"].defines = [self._contract_map[str(self.options.on_contract_violation)]]

# TODO: to remove in conan v2 once cmake_find_package* generators removed
Expand Down

0 comments on commit ff011a8

Please sign in to comment.