bshell: add line-editor and file-based input support
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
#[=======================================================================[.rst:
|
||||
FindFX
|
||||
------------
|
||||
|
||||
Find the FX library and header directories
|
||||
|
||||
Imported Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines the following :prop_tgt:`IMPORTED` target:
|
||||
|
||||
``FX::FX``
|
||||
The FX library, if found
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module will set the following variables in your project:
|
||||
|
||||
``FX_FOUND``
|
||||
true if the FX C headers and libraries were found
|
||||
``FX_INCLUDE_DIR``
|
||||
directories containing the FX C headers.
|
||||
|
||||
``FX_LIBRARY``
|
||||
the C library to link against
|
||||
|
||||
Hints
|
||||
^^^^^
|
||||
|
||||
The user may set the environment variable ``FX_PREFIX`` to the root
|
||||
directory of a FX library installation.
|
||||
#]=======================================================================]
|
||||
|
||||
set (FX_SEARCH_PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/usr/local
|
||||
/usr/local/share
|
||||
/usr
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
${FX_PREFIX}
|
||||
$ENV{FX_PREFIX})
|
||||
|
||||
if (FX_STATIC)
|
||||
set(_lib_suffix "-s")
|
||||
endif ()
|
||||
|
||||
set(assemblies ${FX_FIND_COMPONENTS})
|
||||
set(required_vars)
|
||||
|
||||
if (NOT FX_INCLUDE_DIR)
|
||||
find_path(FX_INCLUDE_DIR
|
||||
NAMES fx/misc.h ${FX_FIND_ARGS}
|
||||
PATH_SUFFIXES include
|
||||
PATHS ${FX_SEARCH_PATHS})
|
||||
endif ()
|
||||
|
||||
set(required_vars FX_INCLUDE_DIR)
|
||||
|
||||
foreach (assembly ${assemblies})
|
||||
string(TOLOWER ${assembly} header_name)
|
||||
string(REPLACE "." "_" macro_name ${assembly})
|
||||
string(TOUPPER ${macro_name} macro_name)
|
||||
|
||||
set(lib_name ${assembly}${_lib_suffix})
|
||||
|
||||
if (NOT ${macro_name}_LIBRARY)
|
||||
find_library(${macro_name}_LIBRARY
|
||||
NAMES ${lib_name} ${FX_FIND_ARGS}
|
||||
PATH_SUFFIXES lib
|
||||
PATHS ${FX_SEARCH_PATHS})
|
||||
else ()
|
||||
# on Windows, ensure paths are in canonical format (forward slahes):
|
||||
file(TO_CMAKE_PATH "${${macro_name}_LIBRARY}" ${macro_name}_LIBRARY)
|
||||
endif()
|
||||
|
||||
list(APPEND required_vars ${macro_name}_LIBRARY)
|
||||
endforeach (assembly)
|
||||
|
||||
unset(FX_FIND_ARGS)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(FX
|
||||
REQUIRED_VARS ${required_vars})
|
||||
|
||||
if (FX_FOUND)
|
||||
set(created_targets)
|
||||
foreach (assembly ${assemblies})
|
||||
set(target_name ${assembly})
|
||||
string(REPLACE "fx." "" target_name ${target_name})
|
||||
string(SUBSTRING ${target_name} 0 1 target_name_prefix)
|
||||
string(TOUPPER ${target_name_prefix} target_name_prefix)
|
||||
string(SUBSTRING ${target_name} 1 -1 target_name_suffix)
|
||||
set(target_name ${target_name_prefix}${target_name_suffix})
|
||||
|
||||
string(TOLOWER ${assembly} header_name)
|
||||
string(REPLACE "." "_" macro_name ${assembly})
|
||||
string(REPLACE "." "_" macro_name ${assembly})
|
||||
string(TOUPPER ${macro_name} macro_name)
|
||||
|
||||
set(lib_name ${assembly}${_lib_suffix})
|
||||
|
||||
if (NOT TARGET FX::${target_name})
|
||||
add_library(FX::${target_name} UNKNOWN IMPORTED)
|
||||
set_target_properties(FX::${target_name} PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${FX_INCLUDE_DIR}")
|
||||
target_compile_definitions(FX::${target_name} INTERFACE _CRT_SECURE_NO_WARNINGS=1)
|
||||
|
||||
if (FX_STATIC)
|
||||
target_compile_definitions(FX::${target_name} INTERFACE FX_STATIC=1)
|
||||
endif ()
|
||||
|
||||
set_target_properties(FX::${target_name} PROPERTIES
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION "${${macro_name}_LIBRARY}")
|
||||
set(created_targets ${created_targets} ${assembly})
|
||||
endif ()
|
||||
endforeach (assembly)
|
||||
endif()
|
||||
Reference in New Issue
Block a user