Reputation: 25
I’m working on a C++ application that integrates with Unreal Engine 5.5 libraries. I want to dynamically configure the Unreal Engine include paths in my CMake setup without hardcoding the engine directory (e.g., /home/user/UnrealEngine5.5). This is to make the project more portable across systems and installations.
What I’ve Tried:
I wrote a FindUnreal.cmake module that hardcodes the paths:
set(UNREAL_INCLUDE_DIRS
${UNREAL_ENGINE_DIR}/Engine/Source
${UNREAL_ENGINE_DIR}/Engine/Source/Runtime
${UNREAL_ENGINE_DIR}/Engine/Source/ThirdParty
)
set(UNREAL_LIBRARY_DIRS
${UNREAL_ENGINE_DIR}/Engine/Binaries/Linux
)
file(GLOB UNREAL_LIBRARIES "${UNREAL_LIBRARY_DIRS}/*.so")
if (NOT UNREAL_LIBRARIES)
message(FATAL_ERROR "No Unreal Engine libraries found in: ${UNREAL_LIBRARY_DIRS}")
endif ()
in the CMakelists.txt
include_directories(
src/
${UNREAL_INCLUDE_DIRS}
)
While this works, it’s not portable. I’d like to dynamically discover these paths, perhaps using find_path() or environment variables.
I attempted using an environment variable (UE_ENGINE_DIR) to specify the engine root, but I'm unsure how to recursively add all the required include paths.
Question:
Additional Context:
I’ve verified that Unreal Engine is installed in /home/user/UnrealEngine5.5. The relevant header files (CoreMinimal.h, Containers/Array.h) are located under Engine/Source/Runtime/Core/Public. However, due to missing include paths for dependencies like CoreTypes.h, the build fails unless I manually add these paths to CMakeLists.txt.
Any advice or examples would be greatly appreciated!
Upvotes: 0
Views: 61