Skip to content

Commit c5f640b

Browse files
committed
Update cmake
1 parent 7cd0e9e commit c5f640b

File tree

2 files changed

+12
-26
lines changed

2 files changed

+12
-26
lines changed

CMakeLists.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,22 @@ set(XCPP_TAGFILES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/share/xeus-cpp/tagfiles)
3030
set(XEUS_CPP_CONF_DIR "etc/xeus-cpp" CACHE STRING "xeus-cpp configuration directory")
3131
set(XCPP_TAGCONFS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/etc/xeus-cpp/tags.d)
3232

33+
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/xeus-cpp/xeus_cpp_config.hpp.in"
34+
"${CMAKE_CURRENT_SOURCE_DIR}/include/xeus-cpp/xeus_cpp_config.hpp")
35+
3336
# Versionning
3437
# ===========
3538

36-
file(STRINGS "VERSION" XEUS_CPP_VERSION)
37-
string(REPLACE "." ";" VERSION_LIST "${XEUS_CPP_VERSION}")
38-
string(REPLACE "\\" "" VERSION_LIST "${VERSION_LIST}")
39-
list(GET VERSION_LIST 0 XEUS_CPP_VERSION_MAJOR)
40-
list(GET VERSION_LIST 1 XEUS_CPP_VERSION_MINOR)
41-
list(GET VERSION_LIST 2 XEUS_CPP_VERSION_PATCH)
42-
39+
file(STRINGS "${XEUS_CPP_INCLUDE_DIR}/xeus-cpp/xeus_cpp_config.hpp" version_defines
40+
REGEX "#define XEUS_CPP_VERSION_(MAJOR|MINOR|PATCH|LABEL)")
41+
foreach (ver ${version_defines})
42+
if (ver MATCHES "#define XEUS_CPP_VERSION_(MAJOR|MINOR|PATCH|LABEL) +([^ ]+)$")
43+
set(XEUS_CPP_VERSION_${CMAKE_MATCH_1} "${CMAKE_MATCH_2}" CACHE INTERNAL "")
44+
endif ()
45+
endforeach ()
4346
set(${PROJECT_NAME}_VERSION
44-
${XEUS_CPP_VERSION_MAJOR}.${XEUS_CPP_VERSION_MINOR}.${XEUS_CPP_VERSION_PATCH})
45-
message(STATUS "Building xeus-cpp v${XEUS_CPP_VERSION}")
47+
${XEUS_CPP_VERSION_MAJOR}.${XEUS_CPP_VERSION_MINOR}.${XEUS_CPP_VERSION_PATCH}${XEUS_CPP_VERSION_LABEL})
48+
message(STATUS "Building xeus-cpp v${${PROJECT_NAME}_VERSION}")
4649

4750
# Build options
4851
# =============
@@ -171,9 +174,6 @@ message("Configure kernels: ...")
171174
configure_kernel("/share/jupyter/kernels/xcpp17/")
172175
configure_kernel("/share/jupyter/kernels/xcpp20/")
173176

174-
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/include/xeus-cpp/xeus_cpp_config.hpp.in"
175-
"${CMAKE_CURRENT_SOURCE_DIR}/include/xeus-cpp/xeus_cpp_config.hpp")
176-
177177
# Source files
178178
# ============
179179

test/test_interpreter.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -764,20 +764,6 @@ TEST_SUITE("xmagics_apply"){
764764
REQUIRE(redirect.getCaptured() == "UsageError: %%test is a cell magic, but the cell body is empty.\n"
765765
"If you only intend to display %%test help, please use a double line break to fill in the cell body.\n");
766766
}
767-
TEST_CASE("cell magic with empty cell body") {
768-
xcpp::xmagics_manager manager;
769-
770-
std::stringstream ss;
771-
auto cerr_buff = std::cerr.rdbuf();
772-
std::cerr.rdbuf(ss.rdbuf());
773-
774-
manager.apply("test", "line", "");
775-
776-
std::cerr.rdbuf(cerr_buff);
777-
REQUIRE(ss.str() == "UsageError: %%test is a cell magic, but the cell body is empty.\n"
778-
"If you only intend to display %%test help, please use a double line break to fill in the cell body.\n");
779-
780-
}
781767
}
782768

783769
#if defined(__GNUC__) && !defined(XEUS_CPP_EMSCRIPTEN_WASM_BUILD)

0 commit comments

Comments
 (0)