Executable CMakeLists.txt in root.

 I can not append sources but compiled it by revisement of CMakeLists.txt.




---
$ tree .
.
├── CMakeLists.txt
├── build
└── src
    ├── CMakeLists.txt
    ├── main.c
    └── main.h

2 directories, 4 files

---
$ cd build
$ cmake ..

-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- ========== Configuring Audacity_001 ==========
-- ========== Configuring /home/nakagawa/src/20201024/src ==========
-- ========== Configuring /home/nakagawa/src/20201024 ==========
CMake Error at src/CMakeLists.txt:9 (add_executable):
  add_executable called with incorrect number of arguments


CMake Error at src/CMakeLists.txt:16 (source_organization):
  Unknown CMake command "source_organization".


-- Configuring incomplete, errors occurred!
See also "/home/nakagawa/src/20201024/build/CMakeFiles/CMakeOutput.log".

---
#cmake_minimum_required( VERSION 3.6.1 )
cmake_minimum_required( VERSION 2.8.12.2 )

project( Audacity_001 )

set( topdir "${CMAKE_SOURCE_DIR}" )
add_subdirectory( "src" )
set( TARGET Audacity_001 )
set( TARGET_ROOT ${topdir}/src )

message( STATUS "========== Configuring ${TARGET} ==========" )
message( STATUS "========== Configuring ${TARGET_ROOT} ==========" )
message( STATUS "========== Configuring ${topdir} ==========" )

#add_executable( ${TARGET} ${SOURCES} )
add_executable( ${TARGET} main.c )

list ( APPEND SOURCES
        PRIVATE
                main.c
)
$ cmake ..
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- 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
-- ========== Configuring Audacity_001 ==========
-- ========== Configuring /home/nakagawa/src/20201024/src ==========
-- ========== Configuring /home/nakagawa/src/20201024 ==========
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nakagawa/src/20201024/build

コメント