quinoacomputing / cmake-modules

CMake code for Quinoa and its third-party-library build
http://quinoacomputing.org
Other
1 stars 2 forks source link

Reuse GCC version detection code across repos #9

Closed jbakosi closed 7 years ago

jbakosi commented 7 years ago

Attempting to use g++ 7.1, I bumped into this cmake error, coming out of the detection of the gcc version by calling gcc -dumpversion from cmake:

CMake Error at CMakeLists.txt:175 (list):
      list index: 1 out of range (-1, 0)

The fix is a simple guard, checking the length of the list and not querying the minor version if not returned by -dumpversion.

As the version detection code appears in both tpl and quinoa, I also lifted the corrected code and placed it under the cmake repo in a new file DetectGCCVersion.cmake from which both TPL and quinoa can now use it.

junghans commented 7 years ago

Isn't the compiler version already determined by cmake and stores in ${CMAKE_CXX_COMPILER_VERSION}?

jbakosi commented 7 years ago

Indeed, I did not know about that! I will rewrite this to use that instead and extract the major as that is the only thing we need in FindLAPACK.cmake.

jbakosi commented 7 years ago

Okay, @junghans. This now uses CMAKE_CXX_COMPILER_VERSION and greps the major and uses that in FindLAPACK.cmake.

In concert with https://github.com/quinoacomputing/quinoa/pull/150 and https://github.com/quinoacomputing/quinoa-tpl/pull/16.