Browse Source

Adapted FindCusp to fail silently if cusp is not found. Now configuring fails with a meaningful error message instead of syntax errors.

Former-commit-id: e77388a186
tempestpy_adaptions
David_Korzeniewski 10 years ago
parent
commit
5299ed5172
  1. 49
      resources/cmake/FindCusp.cmake

49
resources/cmake/FindCusp.cmake

@ -23,33 +23,34 @@ find_path(CUSP_INCLUDE_DIR
) )
if(CUSP_INCLUDE_DIR) if(CUSP_INCLUDE_DIR)
list(REMOVE_DUPLICATES CUSP_INCLUDE_DIR) list(REMOVE_DUPLICATES CUSP_INCLUDE_DIR)
endif(CUSP_INCLUDE_DIR)
# Find cusp version
file(STRINGS ${CUSP_INCLUDE_DIR}/cusp/version.h
version
REGEX "#define CUSP_VERSION[ \t]+([0-9x]+)"
)
string(REGEX REPLACE
"#define CUSP_VERSION[ \t]+"
""
version
"${version}"
)
# Find cusp version
file(STRINGS ${CUSP_INCLUDE_DIR}/cusp/version.h
version
REGEX "#define CUSP_VERSION[ \t]+([0-9x]+)"
)
string(REGEX REPLACE
"#define CUSP_VERSION[ \t]+"
""
version
"${version}"
)
#define CUSP_MAJOR_VERSION (CUSP_VERSION / 100000)
#define CUSP_MINOR_VERSION (CUSP_VERSION / 100 % 1000)
#define CUSP_SUBMINOR_VERSION (CUSP_VERSION % 100)
#define CUSP_MAJOR_VERSION (CUSP_VERSION / 100000)
#define CUSP_MINOR_VERSION (CUSP_VERSION / 100 % 1000)
#define CUSP_SUBMINOR_VERSION (CUSP_VERSION % 100)
math(EXPR CUSP_MAJOR_VERSION "${version} / 100000")
math(EXPR CUSP_MINOR_VERSION "${version} / 100 % 1000")
math(EXPR CUSP_PATCH_VERSION "${version} % 100")
math(EXPR CUSP_MAJOR_VERSION "${version} / 100000")
math(EXPR CUSP_MINOR_VERSION "${version} / 100 % 1000")
math(EXPR CUSP_PATCH_VERSION "${version} % 100")
set(CUSP_VERSION "${CUSP_MAJOR_VERSION}.${CUSP_MINOR_VERSION}.${CUSP_PATCH_VERSION}")
set(CUSP_VERSION "${CUSP_MAJOR_VERSION}.${CUSP_MINOR_VERSION}.${CUSP_PATCH_VERSION}")
# Check for required components
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Cusp REQUIRED_VARS CUSP_INCLUDE_DIR VERSION_VAR CUSP_VERSION)
# Check for required components
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Cusp REQUIRED_VARS CUSP_INCLUDE_DIR VERSION_VAR CUSP_VERSION)
set(CUSP_INCLUDE_DIRS ${CUSP_INCLUDE_DIR})
mark_as_advanced(CUSP_INCLUDE_DIR)
set(CUSP_INCLUDE_DIRS ${CUSP_INCLUDE_DIR})
mark_as_advanced(CUSP_INCLUDE_DIR)
endif(CUSP_INCLUDE_DIR)
Loading…
Cancel
Save