I gave another stab at supporting add_subdirectory()
and this time i got it working to the point where CI builds are green and SDK installation works.
It is not perfect though. This is sample project:
# We can use our own project name as one would expect
project(Urho3DAsLibraryExample)
# Add game engine to the project.
add_subdirectory(Urho3D)
# Still need to append module path so UrhoCommon can be found
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/Urho3D/CMake/Modules)
# This is required, but once engine build system start properly using target_include_directories() / target_compile_options() / target_link_libraries() this should be no longer needed.
find_package(Urho3D REQUIRED)
set(SOURCE_FILES main.cpp)
add_executable(Urho3DAsLibraryExample WIN32 ${SOURCE_FILES})
target_include_directories(Urho3DAsLibraryExample PRIVATE ${URHO3D_INCLUDE_DIRS})
target_link_libraries (Urho3DAsLibraryExample ${URHO3D_LIBRARIES} -lpthread)
Code: https://github.com/rokups/Urho3D/tree/add_subdirectory
CI build: https://travis-ci.org/rokups/Urho3D/builds/275409253
@weitjong does this have a chance to be accepted now?