'Cmake project set LANGUAGES from variable

currently I've got the following project definition :

set(supported_languages "CXX OBJC OBJCXX")

project(
  myProj
  VERSION ${ver}
  LANGUAGES ${supported_languages})

where supported_languages is defined as string of parameters delimited by space (i.e. CXX OBJC OBJCXX)

However, it fails since cmake expect to get a list and this is the error I get

CMake Error: Could not find cmake module file: CMakeDetermineCXX OBJC OBJCXXCompiler.cmake

So I've tried to convert it to list list(${supported_languages}) but it still doesn't work.

I wonder what is the best practice to make it work ?



Solution 1:[1]

that error is because (") characterer lets try this

set(supported_languages CXX OBJC OBJCXX)

project(
  myProj
  VERSION ${ver}
  LANGUAGES ${supported_languages})

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 long.kl