> Converting this to an out-of-source build might be tricky, 

I beg to disagree …

No more tricky than the same for somebody who wants to build a rexx external 
function

And would like to detect automatically the proper compiler and linker flags

for the unix like environments 

the thing is automated by using pkgconf/pkg-config ( present in all the linux 
installations )
And having ooRexx build the proper oorexx.pc 
As it would be a courtesy just build it straight away
… not difficult at all to do

Or … less elegant 
In the CMakeLists parse the output of the command “which rexx”
And if the oorexx installation respect the STANDARD unix structure (bin, 
include,lib)
It will be easy to determine the proper flags 

E 

Here is a sample snippet

set( _lc_all "$ENV{LC_ALL}" )
set( ENV{LC_ALL} "C" )
execute_process( COMMAND which rexx
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
        RESULT_VARIABLE _res
        ERROR_VARIABLE  _err
        OUTPUT_VARIABLE OOREXXPATH
        OUTPUT_STRIP_TRAILING_WHITESPACE )
set( ENV{LC_ALL} "${_lc_all}" )

message( "@@    RESULT  '${_res}' " )   
message( "@@    RESULT  '${_err}' ")    
message( "@@    RESULT  '${OOREXXPATH}' " )     

if( NOT "${_res}" STREQUAL "0" )
    message( FATAL_ERROR "
 Open Object Rexx is not installed" )
endif()

get_filename_component( OOREXXHOME "${OOREXXPATH}" REALPATH )

message( "@@    Include flag    '-I${OOREXXHOME}/include'" )
message( "@@    Library flag    '-I${OOREXXHOME}/lib'" )



Which when used in the CmakeLists gives ( when rexx is found )

@@      RESULT  '0' 
@@      RESULT  '' 
@@      RESULT  '/opt/ooRexx_Alt/bin/rexx' 
@@      Include flag    '-I/opt/ooRexx_Alt/bin/rexx/include'
@@      Library flag    '-I/opt/ooRexx_Alt/bin/rexx/lib'


And when not found …

@@      RESULT  '1' 
@@      RESULT  '' 
@@      RESULT  '' 
CMake Error at CMakeLists.txt.test:18 (message):
  

   Open Object Rexx is not installed
Call Stack (most recent call first):
  CMakeLists.txt:131 (include)


-- Configuring incomplete, errors occurre
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to