3

Disclaimer: I'm aware of this question. However, The OP's needs are different to mine: what he actually wants is to port an app to Linux and therefore the answers go in that line, not answering what I want to know: the reasons of the error.


I'm trying to create a dropdown list in CMake GUI following the instructions in here and here

So I have this very simple CMakeLists.txt:

cmake_minimum_required(VERSION 3.6)

project(datasetprograms)

set(CMAKE_CXX_STANDARD 11)

#LINES TO MAKE THE GUI DROP-DOWN:
set(TARGET_ARCHITECTURE “arm” CACHE STRING “Architecture to compile to”)
set_property(CACHE TARGET_ARCHITECTURE PROPERTY STRINGS arm x86)

#Add subdirectories for each project
add_subdirectory(helloworld)

Basically I just copied and pasted, following the instructions. However, instead of having a nice drop-down in the CMake GUI, I got the following error:

CMake Error at CMakeLists.txt:9 (set_property): set_property could not find CACHE variable TARGET_ARCHITECTURE. Perhaps it has not yet been created

Question: What I'm doing wrong?

Community
  • 1
  • 1
El Marce
  • 3,144
  • 1
  • 26
  • 40
  • 1
    That quotes.. have you tried common ones instead (`"`)? – Tsyvarev Dec 14 '16 at 19:35
  • Man! :D I just realized now, come back to answer my own question and see your comment. That what was happening! So sad CMake don't complain about the wrong quotes. Please be my guest and answer the question! – El Marce Dec 14 '16 at 19:49

1 Answers1

3

You may check value of variable TARGET_ARCHITECTURE using message() and you will found CACHE is a part of that value.

This is because you use in set() command double quotes which are not common ones (") but language-specific (). So CMake treats set() command as not CACHE'd one. That is a reason of the error message.

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153