Skip to content

Commit 9519806

Browse files
fix: prevent stale installed FTXUI headers from shadowing build sources (#1300)
1 parent 9c5814b commit 9519806

4 files changed

Lines changed: 38 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ Changelog
44
Next
55
====
66

7+
### Build
8+
- Bugfix: Fix build failure when an older FTXUI is installed in a system
9+
include path (e.g. MacPorts upgrade). A CMake deduplication quirk was
10+
promoting the project's own `-I include/` to `-isystem`, causing package
11+
managers' `-I/opt/local/include` (which may contain stale headers) to
12+
win. See #1299, #1300.
13+
714
7.0.0 (2026-06-13)
815
------------------
916

cmake/ftxui_set_options.cmake

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,34 @@ function(ftxui_set_options library)
2727
PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE};-warnings-as-errors=*"
2828
)
2929

30-
# By using "PUBLIC" as opposed to "SYSTEM INTERFACE", the compiler warning
31-
# are enforced on the headers. This is behind "FTXUI_CLANG_TIDY", so that it
32-
# applies only when developing FTXUI and on the CI. User's of the library
33-
# get only the SYSTEM INTERFACE instead.
30+
# By using "PUBLIC" as opposed to "INTERFACE", the compiler warnings are
31+
# enforced on the headers. This is behind "FTXUI_CLANG_TIDY", so that it
32+
# applies only when developing FTXUI and on the CI. Users of the library
33+
# get only the plain INTERFACE instead.
3434
target_include_directories(${library}
3535
PUBLIC
3636
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
3737
)
3838
else()
39-
target_include_directories(${library} SYSTEM
40-
INTERFACE
41-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
42-
)
39+
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
40+
# Building FTXUI as a standalone project. Do NOT mark as SYSTEM: if
41+
# a sibling FTXUI target (e.g. dom depending on screen) inherits this
42+
# path via INTERFACE_SYSTEM_INCLUDE_DIRECTORIES, CMake demotes the
43+
# private -I to -isystem. That path is then searched *after* any -I
44+
# added by a package manager (e.g. MacPorts' -I/opt/local/include),
45+
# letting a stale installed FTXUI shadow the sources being built.
46+
target_include_directories(${library}
47+
INTERFACE
48+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
49+
)
50+
else()
51+
# Consumed via add_subdirectory / FetchContent: keep SYSTEM so that
52+
# consumers do not receive warnings from FTXUI headers.
53+
target_include_directories(${library} SYSTEM
54+
INTERFACE
55+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
56+
)
57+
endif()
4358
endif()
4459

4560
target_include_directories(${library} SYSTEM

include/ftxui/screen/screen.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ class FTXUI_EXPORT(SCREEN) Screen : public Surface {
3434
// Destructor:
3535
~Screen() override = default;
3636

37+
// Copy:
38+
Screen(const Screen&) = default;
39+
Screen& operator=(const Screen&) = default;
40+
3741
std::string ToString() const;
3842
void ToString(std::string& ss) const;
3943

include/ftxui/screen/surface.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ class FTXUI_EXPORT(SCREEN) Surface {
2727
// Destructor:
2828
virtual ~Surface() = default;
2929

30+
// Copy:
31+
Surface(const Surface&) = default;
32+
Surface& operator=(const Surface&) = default;
33+
3034
// Access a character in the grid at a given position.
3135
std::string& at(int x, int y);
3236
const std::string& at(int x, int y) const;

0 commit comments

Comments
 (0)