Cmake project set LANGUAGES from variable

currently I’ve got the following project definition :

set(supported_languages "CXX OBJC OBJCXX")

  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 ?

set(supported_languages CXX OBJC OBJCXX)


set(supported_languages “CXX;OBJC;OBJCXX”)

If you need the input to be space delimited, convert it to a cmake list with string replace command