flavian
flavian

Reputation: 28511

CMake configuration

I have a simple C project structure:

proj/
  src/
  docs/
  build/
  tests/
  lib/

Trying to write a suitable CMake file.

My attempt so far: http://pastebin.com/846ZzUev

CMake Error at CMakeLists.txt:6 (PROJECT_SOURCE_DIR): Unknown CMake command "PROJECT_SOURCE_DIR".

-- Configuring incomplete, errors occurred! See also "/path/to/proj/CMakeFiles/CMakeOutput.log".

*How do I: *

Upvotes: 0

Views: 458

Answers (1)

user786653
user786653

Reputation: 30480

  1. Unknown CMake command "PROJECT_SOURCE_DIR". - PROJECT_SOURCE_DIR isn't a command, it's a variable. It looks like you're trying to tell CMake where your code lives - the usual way of doing this is simply placing the CMakeLists.txt file in root of the project.

  2. "Force a custom compiler." - This is covered in the FAQ.

  3. "Auto-include all library folders with automatic file detection." - You mean something like described in this answer(more discussion here)? The idiomatic CMake way of doing this would be to explicitly list the targets with their source files.

Upvotes: 2

Related Questions