[cmakelists.txt] When I create a new project and run cmake then got a error

I just use create_project.py create a new project. My CMake is 2.8-12. Then I run “cmake .” command and got error

RockLeematoMacBook-Pro:TestCMake rocklee$ cmake .
– The C compiler identification is Clang 5.0.0
– The CXX compiler identification is Clang 5.0.0
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
Using chipmunk …
You have called ADD_LIBRARY for library audio without any source files. This typically indicates a problem with your CMakeLists.txt file
– Configuring done
CMake Error: CMake can not determine linker language for target: audio
CMake Error: CMake can not determine linker language for target: audio
CMake Error: Cannot determine link language for target “audio”.
– Generating done

And I check the cmakelists.txt with audio directory.

audio

add_subdirectory(${COCOS2D_ROOT}/cocos/audio)

It seems no error.
So I delete this line. Then cmake running right.
why?

Hello, I got the same error here, I just downloaded cocos2d-x 3.3, created a new project, but I couldn’t be able to open it with Qt creator following this tutorial (cocos2d-x with Qt creator), the cmake command has finished with errors

CMake Error: CMake can not determine linker language for target: audio 
CMake Error: CMake can not determine linker language for target: audio
CMake Error: Cannot determine link language for target "audio".

What’s wrong ?

Not sure if you guys have solved this on your own or not, but the solution is to explicitly tell cmake what language the target is written in. The base command is set_target_properties([property] PROPERTIES LINKER LANGUAGE [language]), so that leave us with the following:

set_target_properties(audio PROPERTIES LINKER_LANGUAGE CXX)

Hopefully this will help you or anyone else that searches for this in the future.