Reputation: 5119
OK. I'm able to Configure and Generate successfully from CMake GUI and it appears to generate a bunch of files in my build folder. But it's not creating the Make file. Any ideas?
Edit:
All I did was create a workspace in Eclipse with a main project and a Static Library project. It's a simple HelloWorld application where the main project produces the "Hello" part of the output and the Static Library produces the "World" part of the output.
Does the CMake output give any error message? No. The only output from the CMake GUI is: Configuring done and Generating Done.
Is the correct generator selected? What settings are you using? I'm new to CMake, so I'm not entirely sure what you are asking but I can give you a screen capture:
The screen capture above shows the Eclipse project structure in the background and the CMake GUI with configuration in the foreground. The screen capture below shows the files that do get generated.
----------------------------------------------------- More Info -----------------------------------------------
I deleted all of my build folders and ran cmake again. This time I received the following output with errors:
-- The C compiler identification is Clang 4.2.0
-- The CXX compiler identification is Clang 4.2.0
-- 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
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
World_INCLUDE_DIRS
used as include directory in directory /Users/pdl/Development/Patricia's New World Sandbox/HelloWorldCMake/Hello/src
World_LIBRARIES
linked by target "hello" in directory /Users/pdl/Development/Patricia's New World Sandbox/HelloWorldCMake/Hello/src
-- Configuring incomplete, errors occurred!
Here is the contents of my FindWorld.cmake file:
find_path(World_INCLUDE_DIRS World.h /usr/include "$ENV{WORLD_ROOT}/src")
find_library(World_LIBRARIES libWorld.a /usr/lib "$ENV{WORLD_ROOT}/Debug")
set(World_FOUND TRUE)
if (NOT World_INCLUDE_DIRS)
set(World_FOUND FALSE)
endif (NOT World_INCLUDE_DIRS)
if (NOT World_LIBRARIES)
set(World_FOUND FALSE)
endif (NOT World_LIBRARIES)
WORLD_ROOT is set in my Eclipse Hello project as an Environment Variable with the directory set to "/Users/pdl/Development/Patricia's New World Sandbox/HelloWorldCMake/World". Ah-ha! Could it be that CMake doesn't know what my Eclipse Environment Variables are?
Here is the contents of my Hello CMakeLists.txt file:
cmake_minimum_required(VERSION 2.8.6)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
find_package(World REQUIRED)
include_directories("${World_INCLUDE_DIRS}")
add_executable(hello Hello.cpp)
target_link_libraries(hello ${World_LIBRARIES})
Here is the contents of my World CMakeLists.txt file:
cmake_minimum_required(VERSION 2.8.6)
project(World)
include_directories("${CMAKE_SOURCE_DIR}")
add_library(namer World.cpp World.h)
Sure enough, it's not finding the paths to the World project. This is in my CMakeCache.txt file:
//Value Computed by CMake
Project_BINARY_DIR:STATIC=/Users/pdl/Development/Patricia's New World Sandbox/hello_world_build
//Value Computed by CMake
Project_SOURCE_DIR:STATIC=/Users/pdl/Development/Patricia's New World Sandbox/HelloWorldCMake/Hello/src
//Path to a file.
World_INCLUDE_DIRS:PATH=World_INCLUDE_DIRS-NOTFOUND
//Path to a library.
World_LIBRARIES:FILEPATH=World_LIBRARIES-NOTFOUND
Upvotes: 1
Views: 10487
Reputation: 5119
My first problem was that I had accidentally ran make in a different build directory. I deleted all build directories and tried again. Then I received the following error:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
World_INCLUDE_DIRS
used as include directory in directory /Users/pdl/Development/Patricia's New World Sandbox/HelloWorldCMake/Hello/src
World_LIBRARIES
linked by target "hello" in directory /Users/pdl/Development/Patricia's New World Sandbox/HelloWorldCMake/Hello/src
-- Configuring incomplete, errors occurred!
Contemplating this error, it occurred to me that CMake, of course, is not aware of my Eclipse Environment Variables.
Upvotes: 2