Remove specific file from cmake build - Stack Overflow
stackoverflow.com › questions › 16449676May 08, 2013 · Instead, you can use the list(REMOVE_ITEM ...) command: file(GLOB sources "*.cpp") file(GLOB headers "*.h") set(testing_sources ${sources}) list(REMOVE_ITEM testing_sources ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp) list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/testing.cpp) add_executable(main ${sources} ${headers}) add_executable(testing ${testing_sources} ${headers})
remove — CMake 3.23.0-rc3 Documentation
cmake.org › cmake › helpremove — CMake 3.23.0-rc3 Documentation remove ¶ Deprecated since version 3.0: Use the list (REMOVE_ITEM) command instead. remove (VAR VALUE VALUE ...) Removes VALUE from the variable VAR. This is typically used to remove entries from a vector (e.g. semicolon separated list). VALUE is expanded.
list — CMake 3.23.0-rc4 Documentation
cmake.org › cmake › helpIntroduction ¶. The list subcommands APPEND, INSERT, FILTER, PREPEND , POP_BACK, POP_FRONT, REMOVE_AT, REMOVE_ITEM , REMOVE_DUPLICATES, REVERSE and SORT may create new values for the list within the current CMake variable scope. Similar to the set () command, the LIST command creates new variable values in the current scope, even if the list ...