-
-
Notifications
You must be signed in to change notification settings - Fork 49
Closed
Description
What happened?
The CMakeLists.txt of Ark leaks compile options to dependent projects, causing them to fail compiling if they don't fulfill the same standards as the Ark codebase.
This is directly caused by using PUBLIC
rather than PRIVATE
in target_compile_options
for ArkReactor
this should rather be PRIVATE
to avoid the leakage.
Here is a list of offending target_compile_options
:
Here is a simple example application that links with Ark, but can't compile due to it:
int foo(int val) {
auto lambda = [] {
int val = 4; // <- Error due to shadowing foo's parameter
return val;
};
return lambda();
}
int main() {
return foo(4);
}
project(test CXX)
set(ARK_BUILD_EXE OFF)
set(ARK_BUILD_MODULES OFF)
set(ARK_ENABLE_SYSTEM OFF)
set(ARK_UNITY_BUILD OFF)
add_subdirectory(Ark)
add_executable(MRE)
target_sources(MRE PUBLIC main.cpp)
target_include_directories(MRE PRIVATE ArkScript/include)
target_link_libraries(MRE PUBLIC ArkReactor)
target_compile_options(MRE PUBLIC "-std=c++20")
The error is directly related to the -Werror -Wshadow
settings that Ark leaks into all linking application:
/home/justin/Projekte/ark-mre/main.cpp: In lambda function:
/home/justin/Projekte/ark-mre/main.cpp:6:9: error: declaration of 'int val' shadows a parameter [-Werror=shadow]
6 | int val = 4;
| ^~~
/home/justin/Projekte/ark-mre/main.cpp:4:13: note: shadowed declaration is here
4 | int foo(int val) {
| ~~~~^~~
/home/justin/Projekte/ark-mre/main.cpp: In function 'int foo(int)':
/home/justin/Projekte/ark-mre/main.cpp:4:13: error: unused parameter 'val' [-Werror=unused-parameter]
What ArkScript version are you seeing the problem on?
dev
Operating System
Linux
Compiler used
GCC
Compiler version used
gcc-Version 14.2.1 20250207 (GCC)
Relevant code & log output
Documentation
- I have read existing related documentation before submitting this report
- I have searched for an existing issue before posting
Metadata
Metadata
Assignees
Labels
No labels