Home > front end >  Cmake project set LANGUAGES from variable
Cmake project set LANGUAGES from variable

Time:03-19

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 ?

CodePudding user response:

that error is because (") characterer lets try this

set(supported_languages CXX OBJC OBJCXX)

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