I am working on a CMake Tutorial and I do this before the section "Adding a Version Number and a Custom Header File". Unfortunately, Xcode does not recognize the generated header file:
Error:
The header file was generated by CMake ok:
TutorialConfig.h.in
// the configured options and settings for Tutorial #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@
CMakeLists.txt
cmake_minimum_required (VERSION 2.6) project (Tutorial) # The version number. set (Tutorial_VERSION_MAJOR 1) set (Tutorial_VERSION_MINOR 0) # configure a header file to pass some of the CMake settings # to the source code configure_file ( "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" "${PROJECT_BINARY_DIR}/TutorialConfig.h" ) # add the binary tree to the search path for include files # so that we will find TutorialConfig.h include_directories("${PROJECT_BINARY_DIR}/src") # add the executable add_executable(Tutorial src/tutorial.cpp)
This is the tutorial I'm working on.
Oh haha I changed #include "src/TutorialConfig.h"to #include "TutorialConfig.h", and everything is fine. I figured this out by checking the project settings:
#include "src/TutorialConfig.h"
#include "TutorialConfig.h"
Xcode, IDE, Linux. , , . - ? , , .
IDE , - , CMake. ( ) . , / . , , TutorialConfig.h.
, IDE . , , / .
, , , , Xcode, build/directory . CMake . , , TutorialConfig.h.
, !