cmake : the simplest case:

 I could not find the case of definition of HAVE_PTHREAD without the src directory after "cmake .." and "cmake .".
The sets are the blow:

---
CmakeLists.txt:
cmake_minimum_required(VERSION 2.8.12.2)

project(lib_a)

#add_executable(Tutorial main.c)
#configure_file(TutorialConfig.h.in TutorialConfig.h)
#configure_file(array_counter.h.in array_counter.h)

set(wxSOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(wxBINARY_DIR ${CMAKE_BINARY_DIR})
set(wxOUTPUT_DIR ${wxBINARY_DIR}/lib)

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

3 directories, 3 files

---
$ 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 done
-- Generating done
-- Build files have been written to: /home/nakagawa/src/20200924/build

---

.
├── CMakeLists.txt
├── build
│   ├── CMakeCache.txt
│   ├── CMakeFiles
│   │   ├── 2.8.12.2
│   │   │   ├── CMakeCCompiler.cmake
│   │   │   ├── CMakeCXXCompiler.cmake
│   │   │   ├── CMakeDetermineCompilerABI_C.bin
│   │   │   ├── CMakeDetermineCompilerABI_CXX.bin
│   │   │   ├── CMakeSystem.cmake
│   │   │   ├── CompilerIdC
│   │   │   │   ├── CMakeCCompilerId.c
│   │   │   │   └── a.out
│   │   │   └── CompilerIdCXX
│   │   │       ├── CMakeCXXCompilerId.cpp
│   │   │       └── a.out
│   │   ├── CMakeDirectoryInformation.cmake
│   │   ├── CMakeOutput.log
│   │   ├── CMakeTmp
│   │   ├── Makefile.cmake
│   │   ├── Makefile2
│   │   ├── TargetDirectories.txt
│   │   ├── cmake.check_cache
│   │   └── progress.marks
│   ├── Makefile
│   └── cmake_install.cmake
├── lib
└── src
    ├── main.c
    └── main.h

8 directories, 22 files

---

$ grep -R . |grep PTHREAD
src/main.h:#define HAVE_PTHREAD 1

コメント