Skip to content

NODE_EDITOR_SHARED added to target public definition #409

Closed

Description

@RealXuChe

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?

Activity

  1. paceholder commented on Feb 14, 2024

    @paceholder
    Owner
  2. paceholder commented on Feb 14, 2024

    @paceholder
    Owner
  3. paceholder commented on Nov 22, 2026

    @paceholder
    Owner

    This is fixed since 3.0.12 (#418). The library now defines NODE_EDITOR_SHARED or NODE_EDITOR_STATIC for its users, based on BUILD_SHARED_LIBS, so you no longer add -DNODE_EDITOR_STATIC yourself. Set BUILD_SHARED_LIBS=OFF for a static build. We build and test the static library on Windows in CI (#546). Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions