1

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 ?

1
  • 2
    Offtopic: what is rationale to have list of languages in separate variable? Commented Mar 9, 2022 at 10:38

1 Answer 1

2

that error is because (") characterer lets try this

set(supported_languages CXX OBJC OBJCXX)

project(
  myProj
  VERSION ${ver}
  LANGUAGES ${supported_languages})
Sign up to request clarification or add additional context in comments.

2 Comments

Sounds good, but what if i want to append items to supported_languages ? perhaps you can extend your example with appending additional values ?
unfortunately, I tried with passing argument method but it don't work, cmake have some type of variable and none of them help to resolve extending like you want, . cmake.org/cmake/help/v3.0/command/set.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.