will the set source in cmakelist works automatically? if the code is set(source…
- User
will the set source in cmakelist works automatically? if the code is set(source “${CMAKE_CURRENT_SOURCE_DIR}/application/src/main.cpp”) , will it compile this file without specifiying anything else?
- Assistant
In a CMakeLists.txt file, setting a variable to specify source files, as in your example, doesn't automatically trigger the compilation of those files. You need to explicitly use those variables with commands that define targets, such as
add_executable()oradd_library(), for the specified sources to be compiled.Given your example:
set(source "${CMAKE_CURRENT_SOURCE_DIR}/application/src/main.cpp")You would then need to create an executable target (for example) using the
add_executable()command and specify the source variable you've just defined:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.