I played with CMake for a while and this works!
Just need to keep in mind we need to specify all include folder before the
include(UrhoCommon)
line since this module read URHO3D_HOME
and URHO3D_INCLUDE_DIRS
.
I did not notice that before you remind me the way how UrhoCommon works. Thanks for that!
So my final CMakeLists.txt
is:
...
# Set CMake modules search path
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
set(URHO3D_HOME "/Users/myusername/git_folder/Urho3D")
set(URHO3D_INCLUDE_DIRS "/Users/myusername/git_folder/Urho3D/Source")
MESSAGE(STATUS "URHO3D_HOME: ${URHO3D_HOME}")
MESSAGE(STATUS "Urho3D include dir: ${URHO3D_INCLUDE_DIRS}")
include_directories(${URHO3D_INCLUDE_DIRS})
# Include Urho3D Cmake common module
# Keep this after defining all the DIRs
include(UrhoCommon)
...
Another thing is we should use path
/Users/myusername/git_folder/Urho3D/Source
instead of
/Users/myusername/git_folder/Urho3D
since there is another include
folder in Urho3D root directory with only header files. Otherwise, the jump to definition
could lead to that folder.
Now it works as I expected!
I am very happy now.
Thanks everyone for help!
I think it could be useful for someone not very familiar with CMake/CLion and want to set up the project like this.