mostly revert module path handling introduced in 27c421e3

chibi/install.h is included in C source files, and providing a different
install.h upon actual installation is inconsistent and dangerous. When
working with a chibi executable within the build tree (i.e., not an
installed executable), the CHIBI_MODULE_PATH environment tweak can be
used to not always specify -I paths on the command line.
This commit is contained in:
Lukas Böger 2021-07-06 10:15:33 +01:00
parent 16b97a6e26
commit 699ffe18e9

View file

@ -342,16 +342,6 @@ string(JOIN ":" default_module_path
${CMAKE_INSTALL_FULL_DATAROOTDIR}/snow ${CMAKE_INSTALL_FULL_DATAROOTDIR}/snow
${CMAKE_INSTALL_FULL_LIBDIR}/snow) ${CMAKE_INSTALL_FULL_LIBDIR}/snow)
# This file will only be used during an installation (and renamed to install.h)
configure_file(include/chibi/install.h.in include/chibi/to-install.h)
# This configuration is for development purpose: a chibi executable shall find
# both compiled libraries in its own build directory and scheme source libraries
# in the source directory.
string(JOIN ":" default_module_path
${CMAKE_CURRENT_BINARY_DIR}/lib
${CMAKE_CURRENT_SOURCE_DIR}/lib)
configure_file(include/chibi/install.h.in include/chibi/install.h) configure_file(include/chibi/install.h.in include/chibi/install.h)
# #
@ -368,12 +358,12 @@ set(chibi-scheme-tests
foreach(e ${chibi-scheme-tests}) foreach(e ${chibi-scheme-tests})
add_test(NAME "${e}" add_test(NAME "${e}"
COMMAND chibi-scheme tests/${e}.scm COMMAND chibi-scheme -I ${CMAKE_CURRENT_BINARY_DIR}/lib tests/${e}.scm
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endforeach() endforeach()
add_test(NAME r5rs-test add_test(NAME r5rs-test
COMMAND chibi-scheme -xchibi tests/r5rs-tests.scm COMMAND chibi-scheme -I ${CMAKE_CURRENT_BINARY_DIR}/lib -xchibi tests/r5rs-tests.scm
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
file(GLOB_RECURSE srfi_tests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/lib file(GLOB_RECURSE srfi_tests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/lib
@ -418,7 +408,9 @@ foreach(e ${testlibs})
string(REGEX REPLACE "/" "_" testname ${e}) string(REGEX REPLACE "/" "_" testname ${e})
string(REGEX REPLACE "/" " " form ${e}) string(REGEX REPLACE "/" " " form ${e})
add_test(NAME "lib_${testname}" add_test(NAME "lib_${testname}"
COMMAND chibi-scheme -e "(import (${form}))" -e "(run-tests)" COMMAND chibi-scheme -I ${CMAKE_CURRENT_BINARY_DIR}/lib
-e "(import (${form}))"
-e "(run-tests)"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endforeach() endforeach()
@ -456,9 +448,8 @@ install(DIRECTORY include/chibi
PATTERN "sexp-*.[hc]" EXCLUDE PATTERN "sexp-*.[hc]" EXCLUDE
PATTERN "*.h.in" EXCLUDE) PATTERN "*.h.in" EXCLUDE)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/chibi/to-install.h install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/chibi/install.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/chibi DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/chibi)
RENAME install.h)
add_library(chibi::chibi ALIAS libchibi-scheme) add_library(chibi::chibi ALIAS libchibi-scheme)