mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-20 06:49:25 +00:00
style: avoid using unintialized variables (#2806)
* style: avoid using unintialized variables Tested with cmake --warn-unintialized -S . -B build * refactor: use function for possibly uninit vars
This commit is contained in:
@@ -64,6 +64,9 @@ if(EIGEN3_INCLUDE_DIR)
|
||||
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
|
||||
|
||||
else(EIGEN3_INCLUDE_DIR)
|
||||
if(NOT DEFINED KDE4_INCLUDE_DIR)
|
||||
set(KDE4_INCLUDE_DIR "")
|
||||
endif()
|
||||
|
||||
find_path(
|
||||
EIGEN3_INCLUDE_DIR
|
||||
|
||||
@@ -57,6 +57,8 @@ endif()
|
||||
|
||||
if(PythonLibsNew_FIND_QUIETLY)
|
||||
set(_pythonlibs_quiet QUIET)
|
||||
else()
|
||||
set(_pythonlibs_quiet "")
|
||||
endif()
|
||||
|
||||
if(PythonLibsNew_FIND_REQUIRED)
|
||||
|
||||
@@ -12,6 +12,8 @@ get_property(
|
||||
|
||||
if(pybind11_FIND_QUIETLY)
|
||||
set(_pybind11_quiet QUIET)
|
||||
else()
|
||||
set(_pybind11_quiet "")
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||
|
||||
@@ -10,6 +10,8 @@ include(CMakeParseArguments)
|
||||
|
||||
if(pybind11_FIND_QUIETLY)
|
||||
set(_pybind11_quiet QUIET)
|
||||
else()
|
||||
set(_pybind11_quiet "")
|
||||
endif()
|
||||
|
||||
# If this is the first run, PYTHON_VERSION can stand in for PYBIND11_PYTHON_VERSION
|
||||
@@ -22,11 +24,16 @@ if(NOT DEFINED PYBIND11_PYTHON_VERSION AND DEFINED PYTHON_VERSION)
|
||||
CACHE STRING "Python version to use for compiling modules")
|
||||
unset(PYTHON_VERSION)
|
||||
unset(PYTHON_VERSION CACHE)
|
||||
else()
|
||||
# If this is set as a normal variable, promote it, otherwise, make an empty cache variable.
|
||||
elseif(DEFINED PYBIND11_PYTHON_VERSION)
|
||||
# If this is set as a normal variable, promote it
|
||||
set(PYBIND11_PYTHON_VERSION
|
||||
"${PYBIND11_PYTHON_VERSION}"
|
||||
CACHE STRING "Python version to use for compiling modules")
|
||||
else()
|
||||
# Make an empty cache variable.
|
||||
set(PYBIND11_PYTHON_VERSION
|
||||
""
|
||||
CACHE STRING "Python version to use for compiling modules")
|
||||
endif()
|
||||
|
||||
# A user can set versions manually too
|
||||
|
||||
Reference in New Issue
Block a user