0
votes

My CMakeLists.txt file looks like this:

project(DeadWeight)

# Versioning
set (DeadWeight_VERSION_MAJOR 0)
set (DeadWeight_VERSION_MINOR 1)

SET( DEBUG_BUILD 1 )
ADD_DEFINITIONS( -DDEBUG )
SET(CMAKE_BUILD_TYPE Debug)

cmake_minimum_required(VERSION 2.8)

file(GLOB DEADWEIGHT_SRC ./src "*.cpp")    

add_executable(${PROJECT_NAME} ${DEADWEIGHT_SRC})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)

Upon loading this into QtCreator and running CMake (completes without errors btw), I am unable to open the source folder in my QtCreator view. When I click the source folder it says: "Cannot open for reading. Access is denied." I am sure I have read-write permissions to the folder in question. Can someone please point out if I am globbing the source files incorrectly? Or am I doing something else wrong? Is this a CMake error or a QtCreator problem?

EDIT: Also, build fails saying: "Missing source filename: File not found" error from MSVC++ 9 compiler.

1

1 Answers

1
votes

Your file command is indeed the problem. You probably meant:

file(GLOB DEADWEIGHT_SRC src/*.cpp)

As an aside, for single-configuration IDEs (like QtCreator) you'd normally set the build type to Debug from the command line / cmake gui rather than in the CMakeLists.txt. For multi-configuration IDEs (like MSVC) it's set from within the IDE.

You probably also don't need to explicitly set the linker language - it should be deduced automatically from the ".cpp" file extensions.