Hi all,
warning: last time I used C++ was 1998. Yesterday was the first time I used cmake.
I managed to build Urho3D for 64bit Desktop like described here: urho3d.github.io/documentation/HEAD/_building.html ( I’m not allowed to post URLs)
Now I want to create an empty solution/project for Visual Studio. Could somebody describe how to do this? I tried to generate a project with this description (urho3d.github.io/documentation/HEAD/_using_library.html), but ended with an error.
What I did:
I created the folders for my project as described, I created the CMakeLists.txt-file in the source-folder and replaced the names for project and executable (both ‘Sector’ as name). I defined URHO3D_HOME with the correct path.
But when I run cmake -G “Visual Studio 12 2013” this happens:
[code]CMake Error at d:/dev/hvfn/cpp/Urho3D-1.31/Source/CMake/Modules/Urho3D-CMake-common.cmake:451 (add_executable):
add_executable called with incorrect number of arguments, no sources provided
Call Stack (most recent call first):
d:/dev/hvfn/cpp/Urho3D-1.31/Source/CMake/Modules/Urho3D-CMake-common.cmake:544
(setup_executable)
CMakeLists.txt:28 (setup_main_executable)
CMake Error at d:/dev/hvfn/cpp/Urho3D-1.31/Source/CMake/Modules/Urho3D-CMake-common.cmake:546 (set_target_properties):
set_target_properties Can not find target to add properties to: Sector
Call Stack (most recent call first):
CMakeLists.txt:28 (setup_main_executable)
– Configuring incomplete, errors occurred!
See also “D:/dev/hvfn/cpp/Sector/Source/CMakeFiles/CMakeOutput.log”.[/code]
The CMakeLists.txt looks like this
# Set project name
project (Sector)
# Set minimum version
cmake_minimum_required (VERSION 2.8.6)
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)
cmake_policy (SET CMP0022 NEW) # INTERFACE_LINK_LIBRARIES defines the link interface
endif ()
if (CMAKE_VERSION VERSION_GREATER 3.0.0 OR CMAKE_VERSION VERSION_EQUAL 3.0.0)
cmake_policy (SET CMP0026 OLD) # Disallow use of the LOCATION target property - therefore we set to OLD as we still need it
cmake_policy (SET CMP0042 NEW) # MACOSX_RPATH is enabled by default
endif ()
endif ()
# Set CMake modules search path
set (CMAKE_MODULE_PATH $ENV{URHO3D_HOME}/Source/CMake/Modules CACHE PATH "Path to Urho3D-specific CMake modules")
# Include Urho3D Cmake common module
include (Urho3D-CMake-common)
# Find Urho3D library
find_package (Urho3D REQUIRED)
include_directories (${URHO3D_INCLUDE_DIRS})
# Define target name
set (TARGET_NAME Sector)
# Define source files
define_source_files ()
# Setup target with resource copying
setup_main_executable ()
What’s wrong? I’m somewhat confused… is there an easier way than this?