XGundam05
So, I’ve been bashing my head into a wall here. I have extremely little experience with CMake, and I can’t get it to include the files in the subdirectories in the Makefile. Any help or insight is extremely appreciated.
Repository is here for the curious
CMakeLists.txt in main directory
I’m using add_subdirectory (TFTApplication) to add the TFTApplication folder
# Set CMake minimum version and CMake policy required by Urho3D-CMake-common module
if (WIN32)
cmake_minimum_required (VERSION 3.2.3) # Going forward all platforms will use this as minimum version
else ()
cmake_minimum_required (VERSION 2.8.6)
endif ()
if (COMMAND cmake_policy)
cmake_policy (SET CMP0003 NEW)
if (CMAKE_VERSION VERSION_GREATER 2.8.12 OR CMAKE_VERSION VERSION_EQUAL 2.8.12)
# INTERFACE_LINK_LIBRARIES defines the link interface
cmake_policy (SET CMP0022 NEW)
endif ()
if (CMAKE_VERSION VERSION_GREATER 3.0.0 OR CMAKE_VERSION VERSION_EQUAL 3.0.0)
# Disallow use of the LOCATION target property - so we set to OLD as we still need it
cmake_policy (SET CMP0026 OLD)
# MACOSX_RPATH is enabled by default
cmake_policy (SET CMP0042 NEW)
endif ()
endif ()
# Set project name
project (TFTApp)
# Set CMake modules search path
set (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
# Include Urho3D CMake common module
include (Urho3D-CMake-common)
# Define target name
set (TARGET_NAME TFTDemo)
# Define source files
define_source_files ()
# Include Source Sub-Directories
add_subdirectory (TFTApplication)
# Setup target with resource copying
setup_main_executable ()
# Setup test cases
if (URHO3D_ANGELSCRIPT)
setup_test (NAME ExternalLibAS OPTIONS Scripts/12_PhysicsStressTest.as -w)
endif ()
if (URHO3D_LUA)
setup_test (NAME ExternalLibLua OPTIONS LuaScripts/12_PhysicsStressTest.lua -w)
endif ()
CMakeLists.txt in TFTApplication directory:
# TFTApplication CMakeLists.txt
define_source_files ()
TFTDisplay.h and TFTDisplay.cpp are in TFTApplication.
And the pertinent portion of the Makefile generated by CMake:
#=============================================================================
# Target rules for targets named TFTDemo
# Build rule for target.
TFTDemo: cmake_check_build_system
$(MAKE) -f CMakeFiles/Makefile2 TFTDemo
.PHONY : TFTDemo
# fast build rule for target.
TFTDemo/fast:
$(MAKE) -f CMakeFiles/TFTDemo.dir/build.make CMakeFiles/TFTDemo.dir/build
.PHONY : TFTDemo/fast
TFTDemo.o: TFTDemo.cpp.o
.PHONY : TFTDemo.o
# target to build an object file
TFTDemo.cpp.o:
$(MAKE) -f CMakeFiles/TFTDemo.dir/build.make CMakeFiles/TFTDemo.dir/TFTDemo.cpp.o
.PHONY : TFTDemo.cpp.o
TFTDemo.i: TFTDemo.cpp.i
.PHONY : TFTDemo.i
# target to preprocess a source file
TFTDemo.cpp.i:
$(MAKE) -f CMakeFiles/TFTDemo.dir/build.make CMakeFiles/TFTDemo.dir/TFTDemo.cpp.i
.PHONY : TFTDemo.cpp.i
TFTDemo.s: TFTDemo.cpp.s
.PHONY : TFTDemo.s
# target to generate assembly for a file
TFTDemo.cpp.s:
$(MAKE) -f CMakeFiles/TFTDemo.dir/build.make CMakeFiles/TFTDemo.dir/TFTDemo.cpp.s
.PHONY : TFTDemo.cpp.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... install/strip"
@echo "... edit_cache"
@echo "... rebuild_cache"
@echo "... install"
@echo "... TFTDemo"
@echo "... list_install_components"
@echo "... install/local"
@echo "... TFTDemo.o"
@echo "... TFTDemo.i"
@echo "... TFTDemo.s"
.PHONY : help