Is it possible to configure CLion to compile source files in a project independently?

前端 未结 5 573
走了就别回头了
走了就别回头了 2020-12-23 17:12

I am currently doing some Project Euler challenges in C using the JetBrains CLion IDE. When I completed these in Python and Java (in PyCharm and IntelliJ, respectively), I w

5条回答
  •  旧时难觅i
    2020-12-23 17:41

    You could define multiple executables in the CMakeLists.txt for each problem.

    instead of

    add_executable(projecteuler ${SOURCE_FILES})
    

    you could define

    add_executable(problem1 problem1.c)
    add_executable(problem2 problem2.c)
    

    Then you get for each executable (problem1, problem2 etc.) a run configuration, which you can run independently. In this case you won't have to rewrite every time, instead you just add the new source file to a new executable.

提交回复
热议问题