user1054922
user1054922

Reputation: 2165

Path variables in CMake

Trying to convert a makefile project to CMake. In my makefile I have something like this:

MY_PATH := ../../../../..

LOCAL_SRC_FILES := main.cpp \
    $(MY_PATH)/AlertIcon.cpp

but the following doesn't work in CMake:

set(MY_PATH, "${CMAKE_SOURCE_DIR}/../../../../..")

add_library(mylib SHARED
            main.cpp
            ${MY_PATH}/AlertIcon.cpp)

What is the proper syntax?

Upvotes: 0

Views: 77

Answers (1)

k.v.
k.v.

Reputation: 1223

In set(MY_PATH "${CMAKE_SOURCE_DIR}/../../../../..") it should be no comma between arguments.

See documentation.

Also, you can use message(${MY_PATH}) to "debug" variable values.

Upvotes: 2

Related Questions