Commit 5baef620 authored by Rolf Eike Beer's avatar Rolf Eike Beer Committed by Rolf Eike Beer

FindLibAStyle: remove confusing default version

On a system without libastyle installed the output was:

  -- Could NOT find LibAStyle: Found unsuitable version "0", but required is at least "3.1" (found LibAStyle_LIBRARIES-NOTFOUND)

Without this default it will be:

  -- Could NOT find LibAStyle (missing: LibAStyle_LIBRARIES LibAStyle_INCLUDE_DIR) (Required is at least version "3.1")

While at it move the code for the version autodetection around a bit to simplify
it a bit.
parent c9df8b57
......@@ -29,9 +29,6 @@ find_path(LibAStyle_INCLUDE_DIR
# astyle is built without RTTI
set(LibAStyle_CFLAGS "-fno-rtti")
# fallback in case the version is not detected later on
set(_libastyle_version "0")
if(LibAStyle_LIBRARIES AND LibAStyle_INCLUDE_DIR)
include(CMakePushCheckState)
include(CheckCXXSourceCompiles)
......@@ -48,11 +45,11 @@ int main()
}" LIBASTYLE_HAS_ASPEEKSTREAM)
if(LIBASTYLE_HAS_ASPEEKSTREAM)
set(_libastyle_version "3.1")
endif()
cmake_pop_check_state()
if(NOT (_libastyle_version STREQUAL "0"))
message(STATUS "LibAStyle version autodetected as ${_libastyle_version} or greater")
else()
set(_libastyle_version "0")
endif()
cmake_pop_check_state()
endif()
include(FindPackageHandleStandardArgs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment