paceholder / nodeeditor

Qt Node Editor. Dataflow programming framework
BSD 3-Clause "New" or "Revised" License
2.92k stars 794 forks source link

Fix compile definition in CMakeLists for static library #418

Open RealXuChe opened 2 months ago

RealXuChe commented 2 months ago

Closes #409

With this PR, I'm able to add static CMake target nodeeditor as a dependency of my project.

I've tested to build it static, but not tested to build it shared. I can test it if you want.

I'm using the following CMake command:

FetchContent_Declare(
        NodeEditor2
        GIT_REPOSITORY https://github.com/RealXuChe/nodeeditor.git
        GIT_TAG 2.2.5
)
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()

Also, maybe I can include this CMake code snippet into the README.md, so people can directly include this library into their project, without building and even installing it in advance?

RealXuChe commented 2 months ago

OK, this still has some bugs, it doesn't work well on Windows, now testing and investigating it.