((c++-mode . ((cmake-ide-project-dir . "/home/peisongxiao/Projects/dofs")
              (cmake-ide-build-dir   . "/home/peisongxiao/Projects/dofs/build/ide")
              (cmake-ide-cmake-args  . ("-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
                                        "-DCMAKE_BUILD_TYPE=Debug"
                                        "-DDOFS_GLOB_SOURCES=ON"
                                        "-DYAML_BUILD_SHARED_LIBS=OFF"
                                        "-DYAML_CPP_BUILD_TESTS=OFF"
                                        "-DYAML_CPP_BUILD_TOOLS=OFF"
                                        "-DYAML_ENABLE_PIC=ON"))
              ;; KEY BIT: let ff-find-other-file look in build/ide/src/** for stubs (time.h -> build/ide/src/.../time.cpp)
              (eval . (let* ((proj (locate-dominating-file default-directory "CMakeLists.txt"))
                             (build (expand-file-name "build/ide" proj)))
                        (setq-local ff-search-directories
                                    (list
                                     "."            ; current dir
                                     "../src/**"    ; sibling source
				     "/home/peisongxiao/Projects/dofs/build/ide/src/**"
                                     (concat build "/src/**") ; generated stubs live here
                                     "/usr/include" "/usr/local/include"))
                        ;; prefer “first TU that includes this header” when available
                        (with-eval-after-load 'cmake-ide
                          (setq cmake-ide-header-search-first-including t
                                cmake-ide-header-search-other-file t))
                        ;; keep Flycheck on
                        (flycheck-mode 1)
			(company-mode 1))))))

((nil . ((cmake-ide-build-dir . "build")
         (cmake-ide-project-dir . ".")
         (cmake-ide-cmake-opts . "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON")
         (cmake-ide-debug . t))))
