Skip to content

Commit

Permalink
Lets use the installed .setting file to gather version information fo…
Browse files Browse the repository at this point in the history
…r pio
  • Loading branch information
BrianCurtis-NOAA authored and kgerheiser committed Jul 26, 2022
1 parent cb4125d commit da47ad6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Modules/FindPIO.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ if(PIO_INCLUDE_DIR)
set(PIO_Fortran_SHARED_FOUND 1)
endif()
endif()

#Set version using installed .settings file
file(READ "${PIO_PREFIX}/lib/libpio.settings" ver)
string(REGEX MATCH "PIO Version:[ \t]*([0-9]*).([0-9]*).([0-9]*)" _ ${ver})
set(PIO_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")

#Check for C components
if(PIO_C_STATIC_LIB)
set(PIO_C_STATIC_FOUND 1)
Expand Down Expand Up @@ -186,6 +192,7 @@ find_package_handle_standard_args(
REQUIRED_VARS
PIO_PREFIX
PIO_INCLUDE_DIR
VERSION_VAR PIO_VERSION
HANDLE_COMPONENTS
)
message(DEBUG "[FindPIO] PIO_FOUND: ${PIO_FOUND}")
Expand All @@ -194,6 +201,7 @@ message(DEBUG "[FindPIO] PIO_FOUND: ${PIO_FOUND}")
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND AND NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY AND _new_components)
message( STATUS "Find${CMAKE_FIND_PACKAGE_NAME}:" )
message( STATUS " - ${CMAKE_FIND_PACKAGE_NAME}_PREFIX [${${CMAKE_FIND_PACKAGE_NAME}_PREFIX}]")
message( STATUS " - ${CMAKE_FIND_PACKAGE_NAME}_VERSION: [${${CMAKE_FIND_PACKAGE_NAME}_VERSION}]")
set(_found_comps)
foreach( _comp ${_search_components} )
if( ${CMAKE_FIND_PACKAGE_NAME}_${_comp}_FOUND )
Expand Down

0 comments on commit da47ad6

Please sign in to comment.