Skip to content

Commit 2e7f6d6

Browse files
committed
Solved some bugs when the project does not have any loader selected.
1 parent c92ac2c commit 2e7f6d6

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

cmake/GeneratorExpressions.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@
3333
# https://gitlab.kitware.com/cmake/cmake/-/issues/19467
3434

3535
macro(cmake_expand_generator_expressions output)
36+
# Convert the list of parameters into a list of arguments
3637
set(CMAKE_GENERATOR_EXPRESSION_LIST "${ARGN}")
3738
set(GENERATOR_EXPRESSION_TEMP_PATH "${CMAKE_CURRENT_BINARY_DIR}/cmake_expand_generator_expressions")
3839
string(REGEX REPLACE ";" " " CMAKE_GENERATOR_EXPRESSION_LIST "${CMAKE_GENERATOR_EXPRESSION_LIST}")
3940
string(REGEX REPLACE "\n" " " CMAKE_GENERATOR_EXPRESSION_LIST "${CMAKE_GENERATOR_EXPRESSION_LIST}")
41+
42+
# Generate a CMake script for executing it (needs the build phase to evaluate the generator expressions)
4043
set(contents
4144
"file(GENERATE"
4245
" OUTPUT \"${GENERATOR_EXPRESSION_TEMP_PATH}/output.tmp\""
@@ -55,8 +58,13 @@ macro(cmake_expand_generator_expressions output)
5558
"${GENERATOR_EXPRESSION_TEMP_PATH}/output.tmp"
5659
GENERATED_OUTPUT
5760
)
61+
5862
# This is to avoid possible side effects, but I decided to remove it for caching purposes
5963
# file(REMOVE_RECURSE "${GENERATOR_EXPRESSION_TEMP_PATH}")
64+
65+
# Clean the output and generate a list
66+
string(STRIP "${GENERATED_OUTPUT}" GENERATED_OUTPUT)
67+
string(REGEX REPLACE "\n" "" GENERATED_OUTPUT "${GENERATED_OUTPUT}")
6068
string(REGEX REPLACE " " ";" GENERATED_OUTPUT "${GENERATED_OUTPUT}")
6169
set(${output} "${GENERATED_OUTPUT}")
6270
endmacro()

source/tests/metacall_python_callback_test/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
#
2-
# Executable name and options
3-
#
4-
51
# Check if loaders, scripts and ports are enabled
62
if(NOT OPTION_BUILD_LOADERS OR NOT OPTION_BUILD_LOADERS_PY OR NOT OPTION_BUILD_LOADERS_NODE
73
OR NOT OPTION_BUILD_SCRIPTS OR NOT OPTION_BUILD_SCRIPTS_PY
84
OR NOT OPTION_BUILD_PORTS OR NOT OPTION_BUILD_PORTS_PY)
95
return()
106
endif()
117

8+
#
9+
# Executable name and options
10+
#
11+
1212
# Target name
1313
set(target metacall-python-callback-test)
1414
message(STATUS "Test ${target}")

source/tests/metacall_reinitialize_test/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Check if loaders, scripts and ports are enabled
2+
if(NOT OPTION_BUILD_LOADERS OR NOT OPTION_BUILD_LOADERS_MOCK)
3+
return()
4+
endif()
5+
16
#
27
# Executable name and options
38
#
@@ -123,7 +128,7 @@ add_test(NAME ${target}
123128
#
124129

125130
add_dependencies(${target}
126-
py_loader
131+
mock_loader
127132
)
128133

129134
#

source/tests/metacall_return_monad_test/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Check if loaders, scripts and ports are enabled
2+
if(NOT OPTION_BUILD_LOADERS OR NOT OPTION_BUILD_LOADERS_PY)
3+
return()
4+
endif()
5+
16
#
27
# Executable name and options
38
#

0 commit comments

Comments
 (0)