cmake's find_package is case sensitive & be smarter about git.
This commit is contained in:
parent
1841541bc4
commit
5048acc9f9
@ -19,13 +19,17 @@ set( CMAKE_BUILD_TYPE Release )
|
|||||||
set( CMAKE_C_FLAGS "-O3" )
|
set( CMAKE_C_FLAGS "-O3" )
|
||||||
|
|
||||||
# Version.
|
# Version.
|
||||||
execute_process( COMMAND git describe --match *-clo* --long --dirty RESULT_VARIABLE status OUTPUT_VARIABLE mpw_version OUTPUT_STRIP_TRAILING_WHITESPACE )
|
find_package( Git )
|
||||||
if( NOT status EQUAL 0 AND EXISTS "VERSION" )
|
if( GIT_FOUND )
|
||||||
|
execute_process( COMMAND "${GIT_EXECUTABLE}" describe --match *-cli* --long --dirty
|
||||||
|
OUTPUT_VARIABLE mpw_version OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||||
|
endif()
|
||||||
|
if( NOT mpw_version MATCHES "." )
|
||||||
file( READ "VERSION" mpw_version )
|
file( READ "VERSION" mpw_version )
|
||||||
string( STRIP ${mpw_version} mpw_version )
|
string( STRIP "${mpw_version}" mpw_version )
|
||||||
endif()
|
endif()
|
||||||
if( mpw_version MATCHES "." )
|
if( mpw_version MATCHES "." )
|
||||||
add_definitions( -DMP_VERSION=${mpw_version} )
|
add_definitions( "-DMP_VERSION=${mpw_version}" )
|
||||||
message( STATUS "Current mpw source version ${mpw_version}..." )
|
message( STATUS "Current mpw source version ${mpw_version}..." )
|
||||||
else()
|
else()
|
||||||
message( STATUS "Current mpw source version unknown..." )
|
message( STATUS "Current mpw source version unknown..." )
|
||||||
@ -35,8 +39,8 @@ endif()
|
|||||||
### DEPENDENCIES
|
### DEPENDENCIES
|
||||||
function( use_mpw_sodium t r )
|
function( use_mpw_sodium t r )
|
||||||
if( USE_SODIUM )
|
if( USE_SODIUM )
|
||||||
target_link_libraries( ${t} sodium )
|
target_link_libraries( "${t}" sodium )
|
||||||
target_compile_definitions( ${t} PUBLIC -DMPW_SODIUM=1 )
|
target_compile_definitions( "${t}" PUBLIC -DMPW_SODIUM=1 )
|
||||||
message( STATUS "${t}: USE_SODIUM is enabled." )
|
message( STATUS "${t}: USE_SODIUM is enabled." )
|
||||||
|
|
||||||
elseif( r STREQUAL "required" )
|
elseif( r STREQUAL "required" )
|
||||||
@ -49,12 +53,12 @@ function( use_mpw_sodium t r )
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function( use_mpw_color t )
|
function( use_mpw_color t )
|
||||||
find_package( CURSES )
|
find_package( Curses )
|
||||||
if( USE_COLOR )
|
if( USE_COLOR )
|
||||||
if ( CURSES_FOUND )
|
if ( CURSES_FOUND )
|
||||||
target_include_directories( ${t} PUBLIC ${CURSES_INCLUDE_DIR} )
|
target_include_directories( "${t}" PUBLIC ${CURSES_INCLUDE_DIR} )
|
||||||
target_link_libraries( ${t} ${CURSES_LIBRARIES} )
|
target_link_libraries( "${t}" ${CURSES_LIBRARIES} )
|
||||||
target_compile_definitions( ${t} PUBLIC -DMPW_COLOR=1 ${CURSES_DEFINITIONS} )
|
target_compile_definitions( "${t}" PUBLIC -DMPW_COLOR=1 ${CURSES_DEFINITIONS} )
|
||||||
message( STATUS "${t}: USE_COLOR is enabled." )
|
message( STATUS "${t}: USE_COLOR is enabled." )
|
||||||
|
|
||||||
elseif( r STREQUAL "required" )
|
elseif( r STREQUAL "required" )
|
||||||
@ -76,8 +80,8 @@ endfunction()
|
|||||||
|
|
||||||
function( use_mpw_json t )
|
function( use_mpw_json t )
|
||||||
if( USE_JSON )
|
if( USE_JSON )
|
||||||
target_link_libraries( ${t} json-c )
|
target_link_libraries( "${t}" json-c )
|
||||||
target_compile_definitions( ${t} PUBLIC -DMPW_JSON=1 )
|
target_compile_definitions( "${t}" PUBLIC -DMPW_JSON=1 )
|
||||||
message( STATUS "${t}: USE_JSON is enabled." )
|
message( STATUS "${t}: USE_JSON is enabled." )
|
||||||
|
|
||||||
elseif( r STREQUAL "required" )
|
elseif( r STREQUAL "required" )
|
||||||
@ -90,12 +94,12 @@ function( use_mpw_json t )
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function( use_mpw_xml t r )
|
function( use_mpw_xml t r )
|
||||||
find_package( LIBXML2 )
|
find_package( LibXml2 )
|
||||||
if( USE_XML )
|
if( USE_XML )
|
||||||
if ( LIBXML2_FOUND )
|
if ( LIBXML2_FOUND )
|
||||||
target_include_directories( ${t} PUBLIC ${LIBXML2_INCLUDE_DIR} )
|
target_include_directories( "${t}" PUBLIC ${LIBXML2_INCLUDE_DIR} )
|
||||||
target_link_libraries( ${t} ${LIBXML2_LIBRARIES} )
|
target_link_libraries( "${t}" ${LIBXML2_LIBRARIES} )
|
||||||
target_compile_definitions( ${t} PUBLIC -DMPW_XML=1 ${LIBXML2_DEFINITIONS} )
|
target_compile_definitions( "${t}" PUBLIC -DMPW_XML=1 ${LIBXML2_DEFINITIONS} )
|
||||||
message( STATUS "${t}: USE_XML is enabled." )
|
message( STATUS "${t}: USE_XML is enabled." )
|
||||||
|
|
||||||
elseif( r STREQUAL "required" )
|
elseif( r STREQUAL "required" )
|
||||||
|
Loading…
Reference in New Issue
Block a user