I have a CMakeLists.txt file:
CMAKE_MINIMUM_REQUIRED(VERSION 3.1) PROJECT(MyProject) FILE(GLOB_RECURSE sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) FILE(GLOB_RECURSE headers RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h) ADD_EXECUTABLE(AnyNameHere, ${sources})
When I use "Configure" in CMake, I get this error:
CMake error in CMakeLists.txt: 8 (ADD_EXECUTABLE): target name "AnyNameHere" is reserved or invalid for certain CMake functions, such as generator expressions, and may lead to undefined behavior.
I changed the name, but I get the same error no matter what name I choose. I checked the documentation, and all the characters that I used for the name seem to be valid, and I assume that the actual error is somewhere else.
Can you guide me to fix this?
EDIT:
I also simplified the script to only have:
CMAKE_MINIMUM_REQUIRED(VERSION 3.1) PROJECT(MyProject) ADD_EXECUTABLE(AnyNameHere, HelloWorld.cpp)
with the same error. I am using CMake GUI, version 3.1
source share