NODE_EDITOR_SHARED added to target public definition
RealXuChe opened this issue · 2 comments
RealXuChe commented
I'm trying to use NE2 in my project with the following CMake file:
# Node Editor 2
FetchContent_Declare(
NodeEditor2
GIT_REPOSITORY git@github.com:paceholder/nodeeditor.git
GIT_TAG 2.2.4
)
FUNCTION( NE2_MakeAvailable )
set(BUILD_TESTING OFF)
set(BUILD_EXAMPLES OFF)
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
FetchContent_MakeAvailable(NodeEditor2)
ENDFUNCTION ()
NE2_MakeAvailable()
target_compile_definitions(Designer PRIVATE -DNODE_EDITOR_STATIC)
target_link_libraries(Designer PRIVATE nodes)
However here, NODE_EDITOR_SHARED
is defined, making both NODE_EDITOR_SHARED
and NODE_EDITOR_STATIC
defined.
Compile will then fail:
cmake-build-debug/_deps/nodeeditor2-src/include/nodes/internal/Export.hpp:43:6: 错误:#error "Cannot link against shared and static simultaneously."
43 | # error "Cannot link against shared and static simultaneously."
| ^~~~~
I don't see why there's a public definition of NODE_EDITOR_SHARED
. How can I fix this? Or is this a mistake?
paceholder commented
Hello,
I think there is some inconsistency in the header file
`include/QtNodes/internal/Export.hpp`. The library is built shared in 99%
of cases, I do not remember any complaints about it.
Maybe you could try to write in CMakeLists.txt at the line 157 an
expression:
target_compile_definitions(QtNodes
PUBLIC
*- NODE_EDITOR_SHARED+ $<IF:$<BOOL:BUILD_SHARED_LIBS>,
NODE_EDITOR_SHARED, NODE_EDITOR_STATIC>*
PRIVATE
NODE_EDITOR_EXPORTS
If this works, please make a make request.
Best,
Dmitry
…On Wed, Feb 14, 2024 at 2:16 PM RealXuChe ***@***.***> wrote:
I'm trying to use NE2 in my project with the following CMake file:
# Node Editor 2
FetchContent_Declare(
NodeEditor2
GIT_REPOSITORY ***@***.***:paceholder/nodeeditor.git
GIT_TAG 2.2.4
)FUNCTION( NE2_MakeAvailable )
set(BUILD_TESTING OFF)
set(BUILD_EXAMPLES OFF)
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
FetchContent_MakeAvailable(NodeEditor2)ENDFUNCTION ()
NE2_MakeAvailable()
target_compile_definitions(Designer PRIVATE -DNODE_EDITOR_STATIC)target_link_libraries(Designer PRIVATE nodes)
However here
<https://github.com/paceholder/nodeeditor/blob/8f9d655b50c8abad34a84a824bc9528ef6251e4c/CMakeLists.txt#L157>,
NODE_EDITOR_SHARED is defined, making both NODE_EDITOR_SHARED and
NODE_EDITOR_STATIC defined.
Compile will then fail:
cmake-build-debug/_deps/nodeeditor2-src/include/nodes/internal/Export.hpp:43:6: 错误:#error "Cannot link against shared and static simultaneously."
43 | # error "Cannot link against shared and static simultaneously."
| ^~~~~
I don't see why there's a public definition of NODE_EDITOR_SHARED. How
can I fix this? Or is this a mistake?
—
Reply to this email directly, view it on GitHub
<#409>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACO3CA2REI5H7TK5YPPVWTYTS2KXAVCNFSM6AAAAABDIIXYISVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEZTIMZSHE3DANQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
paceholder commented
You'd need to omit your "NODE_EDITOR_STATIC" definition in the
target_compile_definitions command
and maybe build with
*> cmake .. -DBUILD_SHARED_LIBS=off*
or just keep the switch active set(BUILD_SHARED_LIBS OFF)
On Wed, Feb 14, 2024 at 3:53 PM Dmitry Pinaev ***@***.***>
wrote:
… Hello,
I think there is some inconsistency in the header file
`include/QtNodes/internal/Export.hpp`. The library is built shared in 99%
of cases, I do not remember any complaints about it.
Maybe you could try to write in CMakeLists.txt at the line 157 an
expression:
target_compile_definitions(QtNodes
PUBLIC
*- NODE_EDITOR_SHARED+ $<IF:$<BOOL:BUILD_SHARED_LIBS>,
NODE_EDITOR_SHARED, NODE_EDITOR_STATIC>*
PRIVATE
NODE_EDITOR_EXPORTS
If this works, please make a make request.
Best,
Dmitry
On Wed, Feb 14, 2024 at 2:16 PM RealXuChe ***@***.***>
wrote:
> I'm trying to use NE2 in my project with the following CMake file:
>
> # Node Editor 2
> FetchContent_Declare(
> NodeEditor2
> GIT_REPOSITORY ***@***.***:paceholder/nodeeditor.git
> GIT_TAG 2.2.4
> )FUNCTION( NE2_MakeAvailable )
> set(BUILD_TESTING OFF)
> set(BUILD_EXAMPLES OFF)
> set(BUILD_SHARED_LIBS OFF)
> set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
> FetchContent_MakeAvailable(NodeEditor2)ENDFUNCTION ()
> NE2_MakeAvailable()
> target_compile_definitions(Designer PRIVATE -DNODE_EDITOR_STATIC)target_link_libraries(Designer PRIVATE nodes)
>
> However here
> <https://github.com/paceholder/nodeeditor/blob/8f9d655b50c8abad34a84a824bc9528ef6251e4c/CMakeLists.txt#L157>,
> NODE_EDITOR_SHARED is defined, making both NODE_EDITOR_SHARED and
> NODE_EDITOR_STATIC defined.
>
> Compile will then fail:
>
> cmake-build-debug/_deps/nodeeditor2-src/include/nodes/internal/Export.hpp:43:6: 错误:#error "Cannot link against shared and static simultaneously."
> 43 | # error "Cannot link against shared and static simultaneously."
> | ^~~~~
>
> I don't see why there's a public definition of NODE_EDITOR_SHARED. How
> can I fix this? Or is this a mistake?
>
> —
> Reply to this email directly, view it on GitHub
> <#409>, or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AACO3CA2REI5H7TK5YPPVWTYTS2KXAVCNFSM6AAAAABDIIXYISVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEZTIMZSHE3DANQ>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>