To begin with, I'm new to CMake.
Folder structure
root_project
|─── CMakeLists.txt
|─── build
|─── Project 1
| |─── build
| | |─── Debug
| | └─── Release
| |─── CMakeLists.txt
| |─── source
| | └─── include
| |─── resource
| └─── header
└─── Project 2
|─── build
| |─── Debug
| └─── Release
|─── source
| |─── CMakeLists.txt
| └─── include
|─── resource
└─── header
CMake files
The CMakeLists.txt for the root_project:
# Specify the minimum version for CMake
cmake_minimum_required(VERSION 3.8.2 FATAL_ERROR)
# Project's name
project("RootProject X")
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt.")
ENDIF()
OPTION(BUILD_TESTS "Decides whether the unit tests will be built." ON)
# C/C++ languages required.
enable_language(C)
enable_language(CXX)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Only allow 64bit architecture
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
# 64bit
message(STATUS "Compiling for x86-64 platform. Proceeding...")
ELSEIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
# 32bit
message(FATAL_ERROR "Compiling for x86 platform. This is not supported. Aborting...")
ELSE()
# unidentified architecture
message(FATAL_ERROR "Running on unidentified architecture. This is not supported. Aborting...")
ENDIF()
# Abort when OpenGL is not found
FIND_PACKAGE(OpenGL 4.5 REQUIRED)
IF(NOT VULKAN_FOUND)
message(WARNING "Could not find Vulkan library.")
ENDIF()
# Add the modules
add_subdirectory("Project 1")
add_subdirectory("Project 2")
The CMakeLists for Project 1:
# Specify the minimum version for CMake
cmake_minimum_required(VERSION 3.8.2 FATAL_ERROR)
project("Project 1")
# Set the version number of the project here
set(VERSION_MAJOR "0")
set(VERSION_MINOR "1")
set(VERSION_PATCH "0")
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
find_package(OpenGL 4.5 REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/sources/third-party-include/)
link_libraries(${OPENGL_gl_LIBRARY})
add_definitions(${OpenGL_DEFINITIONS})
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/sources/include/)
# ToDo: Testing
set(HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/sources/include/Engine.h
)
set(SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/source/Engine.cpp
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
if(WIN32)
# currently add_executable for testing purpose
add_executable("Project 1" WIN32
#${HEADERS}
${SOURCES}
)
ELSEIF(UNIX AND NOT APPLE)
add_library("Project 1"
${HEADERS}
${SOURCES}
)
ELSE()
# The system is not supported
message(FATAL_ERROR "System not supported.")
ENDIF()
target_link_libraries(DarkEngine ${OPENGL_gl_LIBRARY})
The CMakeLists for Project 2:
# Specify the minimum version for CMake
cmake_minimum_required(VERSION 3.8.2 FATAL_ERROR)
project("Project 2")
# Set the version number of the project here
set(VERSION_MAJOR "0")
set(VERSION_MINOR "1")
set(VERSION_PATCH "0")
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
set(HEADERS
)
set(SOURCES
)
source_group(headers FILES ${HEADERS})
source_group(sources FILES ${SOURCES})
add_executable("Project 2" WIN32
${HEADERS}
${SOURCES}
)
target_link_libraries("Project 2" "Project 1")
Question/Problem
Note: I am trying to achieve an out-of-source build where Project 1 is an Engine which is used from Project 2.
Commands I run under build of root_project: cmake .. -G "Visual Studio 15 2017 Win64"
Project 2 doesn't link against Project 1
Project 2 doesn't show up in VS 2017
My own header files under /include for Project 1 will be shown in External Dependencies in VS 2017 instead of source
Turning my comment into an answer
You just need to specify sources for your Project 2 target.
I've given you example a try and CMake gives you an configuration error (which is probably why it won't show up/doesn't rewrite the solution/project files, if you add the second project):
CMake Error at CMakeLists.txt:23 (add_executable):
add_executable called with incorrect number of arguments, no sources provided
And yes, if you add e.g. a not yet existing src/main.cpp to SOURCES you will get:
CMake Error at CMakeLists.txt:23 (add_executable):
Cannot find source file:
src/main.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx
So the workflow in CMake is always to first create the source file and then add to your CMakeLists.txt. With an IDE like VS you could just add a new item to your project (like you would do for non-generated projects) and then add it to your CMakeLists.txt file.
For some of my projects I've created a check_and_create_source() function called inside overwritten add_executable() calls, but using it for some years I can now say there is no real benefit in that approach. You still need to run a ZERO_CHECK build to get the empty files created/before you can start (and you get confused when you mistyped an inclusion for an existing source file).
And I personally don't like the globbing alternative (see Why is cmake file GLOB evil? and CMake/Ninja attempting to compile deleted `.cpp` file)
Related
I used CMake to compile a framework into three different .lib files, and one .sln file. The project is structured as such
UeiDaqFramework
|-CMakeLists.txt
|-build
| |-Framework_static.sln
| | - other cmake files and stuff
|-UeiDaqCore
| |-CMakeLists.txt
| |-source code for this subproject
|-UeiSimuDriver
| |-CMakeLists.txt
| |-source code for this subproject
|-UeiPDNADriver
| |-CMakeLists.txt
| |-source code for this subproject
|
|-Output
|-UeiDaqCore.lib
|-UeiSimuDriver.lib
|-UeiPDNADriver.lib
My test code require a Framework_static.lib in its include file instead of a .sln file, and I do not know how to combine the three existing .lib files using cmake. I did attempt to follow what this CMake - combine multiple libraries into one answer suggested, by just building all the source files into a single library, but I'm new to CMake, and it did not work. Here is the CmakeLists.txt file at the top directory of my project.
cmake_minimum_required(VERSION 3.13.0 FATAL_ERROR)
set(CMAKE_SYSTEM_VERSION CACHE TYPE INTERNAL FORCE)
project(Framework_static_vc15)
################################################################################
# Set target arch type if empty. Visual studio solution generator provides it.
################################################################################
if(NOT CMAKE_VS_PLATFORM_NAME)
set(CMAKE_VS_PLATFORM_NAME "x64")
endif()
message("${CMAKE_VS_PLATFORM_NAME} architecture in use")
if(NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32"))
message(FATAL_ERROR "${CMAKE_VS_PLATFORM_NAME} arch is not supported!")
endif()
################################################################################
# Global configuration types
################################################################################
set(CMAKE_CONFIGURATION_TYPES
"Debug"
"Release"
CACHE STRING "" FORCE
)
################################################################################
# Global compiler options
################################################################################
if(MSVC)
# remove default flags provided with CMake for MSVC
set(CMAKE_CXX_FLAGS "")
set(CMAKE_CXX_FLAGS_DEBUG "")
set(CMAKE_CXX_FLAGS_RELEASE "")
endif()
################################################################################
# Global linker options
################################################################################
if(MSVC)
# remove default flags provided with CMake for MSVC
set(CMAKE_EXE_LINKER_FLAGS "")
set(CMAKE_MODULE_LINKER_FLAGS "")
set(CMAKE_SHARED_LINKER_FLAGS "")
set(CMAKE_STATIC_LINKER_FLAGS "")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "${CMAKE_STATIC_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS}")
endif()
################################################################################
# Nuget packages function stub.
################################################################################
function(use_package TARGET PACKAGE VERSION)
message(WARNING "No implementation of use_package. Create yours.")
endfunction()
################################################################################
# Common utils
################################################################################
include(CMake/Utils.cmake)
################################################################################
# Additional Global Settings(add specific info there)
################################################################################
include(CMake/GlobalSettingsInclude.cmake OPTIONAL)
################################################################################
# Use solution folders feature
################################################################################
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
################################################################################
# Sub-projects
################################################################################
add_subdirectory(Source/UeiDaqCore)
add_subdirectory(Source/UeiPDNADriver)
add_subdirectory(Source/UeiSimuDriver)
These CMakeLists.txt files were generated automatically by a generator that takes a visual studio .sln file and converts it to a .txt tree. Heres the link to the converter if anyone is interested. https://cmakeconverter.readthedocs.io/en/develop/intro.html
Im not sure if I need to rewrite Just the top level .txt file, or if I need to rewrite all the CMakeLists.txt files. Any help would be appreciated.
I assume the build of the shared libs is within the subdirectories, because your CMakeLists.txt does not contain any add_library command.
To get a static library containing all sources you have to
Collect all sources
Add command to build the static library
For 1. add the following to every subdir/CMakeLists.txt
set(SOURCES # This creates a list of sources called SOURCES
myFileA.cpp # This adds an item to the list
myFileB.cpp
${SOURCES} # This adds all items of existing list SOURCES to the current list
PARENT_SCOPE # This makes SOURCES visible in the parent CMakeLists.txt
)
For 2. add the static library
add_library(myTestLib_static.c STATIC ${SOURCES})
To begin with, I'm new to CMake.
The project is for the Windows and Linux platform.
Folder Structure
root_project
|─── CMakeLists.txt
|─── Project 1
| |─── build
| | |─── Debug
| | └─── Release
| |─── source
| | |─── CMakeLists.txt
| | └─── include
| |─── resource
| └─── header
└─── Project 2
|─── build
| |─── Debug
| └─── Release
|─── source
| |─── CMakeLists.txt
| └─── include
|─── resource
└─── header
CMake files
The first of these files is for the root project and the second one is for "Project 1" and "Project 2" as just one line is different in the second file.
# Specify the minimum version for CMake
cmake_minimum_required(VERSION 3.8.2)
# Project's name
project("root_project")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt.")
ENDIF()
OPTION(BUILD_TESTS "Decides whether the unit tests will be built." ON)
# C/C++ languages required.
enable_language(C)
enable_language(CXX)
# Set the C++ Version
message("!REQUIRED! -- Supported features = ${cxx_std_14}")
message("Supported features = ${cxx_std_17}")
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Only allow 64bit architecture
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
# 64bit
message(STATUS "Running on x86-64 platform. Proceeding...")
ELSEIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
# 32bit
message(FATAL_ERROR "Running on x86 platform. This is not supported. Aborting...")
ELSE()
# unidentified architecture
message(FATAL_ERROR "Running on unidentified architecture. This is not supported. Aborting...")
ENDIF()
# Abort when OpenGL is not found
IF(NOT OPENGL_FOUND)
message(WARNING "Could not find OpenGL library.")
ENDIF()
IF(NOT VULKAN_FOUND)
message(WARNING "Could not find Vulkan library.")
ENDIF()
message(STATUS "----------------------------------------")
message(STATUS "CMake Binary Dir:" ${CMAKE_BINARY_DIR})
message(STATUS "CMake Source Dir:" ${CMAKE_SOURCE_DIR})
message(STATUS "CMake CFG Dir:" ${CMAKE_CFG_INTDIR})
message(STATUS "CMake exe Dir:" ${EXECUTABLE_OUTPUT_PATH})
message(STATUS "CMake lib Dir:" ${LIBRARY_OUTPUT_PATH})
# Add the modules
add_subdirectory("Project 1")
add subdirectory("Project 2")
The CMakeLists.txt for "Project 1" and "Project 2":
# Specify the minimum version for CMake
cmake_minimum_required(VERSION 3.8.2)
project(Project 1)
# Set the version number of the project here
set(VERSION_MAJOR "0")
set(VERSION_MINOR "1")
set(VERSION_PATCH "0")
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
set(HEADERS
)
set(SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
)
set(HEADERS_WIN32
)
set(SOURCES_WIN32
)
set(HEADERS_LINUX
)
set(SOURCES_LINUX
)
source_group(headers FILES ${HEADERS} ${HEADERS_WIN32} ${HEADERS_LINUX})
source_group(sources FILES ${SOURCES} ${SOURCES_WIN32} ${HEADERS_LINUX})
if(WIN32)
add_library(DarkEngine
${HEADERS}
${SOURCES}
${HEADERS_WIN32}
${SOURCES_WIN32}
)
ELSEIF(UNIX AND NOT APPLE)
add_library(DarkEngine
${HEADERS}
${SOURCES}
${HEADERS_LINUX}
${HEADERS_LINUX}
)
ELSE()
# The system is not supported
message(FATAL_ERROR "System not supported.")
ENDIF()
Note: "Project 1" is a library while "Project 2" is an executable and "Project 2" will be based on Project 1. Think of it as "Project 1" is an Engine and "Project 2" is the Game.
Question
Having this setup, from which folder do I have to call CMake from to be able to open the solution "root_project" in Visual Studio 2017 which contains both projects, "Project 1" and "Project 2". cmake .. -G "Visual Studio 15 2017 Win64"
How to put the binaries into the Debug folder when compiling in Debug mode and how to put them in the Release folder when compiling in Release mode? The Release and Debug folders are there to differentiate between Release and Debug builds like Visual Studio does.
I would try opening the root_project folder directly from the Developer Command Prompt, as per the instructions here:
https://blogs.msdn.microsoft.com/vcblog/2016/10/05/cmake-support-in-visual-studio/
cd root_project
devenv .
This built-in support dumps your binaries somewhere under a temp directory in %APPDATA%, so I added the following in my top-level CMakeLists.txt file to dump the binaries out to a specific folder:
# My understanding of what the output types mean. Check CMAKE documentation
# to confirm:
# ARCHIVE: Static & Import Library directory
# LIBRARY: DLL directory (MODULE)
# RUNTIME: DLL directory (SHARED)
# If you use these lines, VS will automatically create Debug and Release dirs
# under the directories you provide.
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../lib")
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../dll")
# In my project I want Debug and Release to clobber each other because
# I am building a DLL that I want to deploy next to an existing exe that
# loads it, so I explicitly point both scenarios to the same place
# (note the "_DEBUG" and "_RELEASE" suffixes to CMAKE_xxx_OUTPUT_DIRECTORY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_LIST_DIR}/../lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_LIST_DIR}/../lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_LIST_DIR}/../dll")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_LIST_DIR}/../lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_LIST_DIR}/../lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_LIST_DIR}/../dll")
Well, I am new to CMake.
I have the following file structure
haze_removal
|---build
|---bin
| |--Test
| |--CMakeLists.txt
|---lib
| |--libtools.so
|---include
| |--tools.hpp
|---test
| |--main.cpp
| |--CMakeLists.txt
|---src
| |--tools.cpp
| |--CMakeLists.txt
|---CMakeLists.txt
The libtools.so is builded from ../src/tools.cpp. I build the whole project in ../build using the following cmake command:
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
The Test is build from ../test/main.cpp
I build this project successfully. But when I debug Test using gdb ./Test, I can't skip in the function that from libtools.so.
These are my CMakeLists.txt from different directories.
CMakeLists.txt under haze_removal/
cmake_minimum_required(VERSION 2.8)
project(haze_removal)
# find needed package
find_package(OpenCV REQUIRED)
# library directory
add_subdirectory(src)
# test
add_subdirectory(test)
CMakeLists.txt under ../src/
# generate dynamic library
# add source file, include directories
aux_source_directory(. TOOLS_SRC)
include_directories(${PROJECT_SOURCE_DIR}/include)
# generate
add_library(tools SHARED ${TOOLS_SRC})
# set output directory and lib's name
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
set_target_properties(tools PROPERTIES OUTPUT_NAME "tools")
# link library
target_link_libraries(tools ${OpenCV_LIBS})
CMakeLists.txt under ../test/
# add source file, include directories, link directories
aux_source_directory(. EXE_SRC)
include_directories(${PROJECT_SOURCE_DIR}/include)
link_directories(${PROJECT_SOURCE_DIR}/lib)
# generate
add_executable(Test ${EXE_SRC})
# set output directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
# link libraries
target_link_libraries(Test ${OpenCV_LIBS} libtools.so)
My question is how I can debug the functions that from libtools.
Well, I find that why I can't step in the dynamic library even though I set CMAKE_BUILD_TYPE=Debug. Because before I set the build model to Debug I used to set CMAKE_BUILD_TYPE=Release. After I change the build model, I didn't delete the files in the build directory.
I don't know whether the above explanation is right or not, but I do solve my problem.
Thx!
I have cli wrapper function which i am trying to configure in cmake. After i generate the project with cmake the generated .proj file does not have the property of clr support is set to no common languaage runtime support. below is my cmake file
# This is the root ITK CMakeLists file.
cmake_minimum_required(VERSION 2.8.9)
if(COMMAND CMAKE_POLICY)
cmake_policy(SET CMP0003 NEW)
endif()
set_target_properties(${TargetName} PROPERTIES COMPILE_FLAGS "/clr")
SET(LINK_LIBRARIES
D:\\2016\\RandomSlicing\\Processing\\lib\\obliquePlane.lib
)
# The header files
SET(HEADERS
ObliquePlaneWrapper.h
obliquePlane.h
)
# The implementation files
SET(SOURCES
ObliquePlaneWrapper.cpp
)
# Find ITK.
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
# Add this as include directory
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}
${SOURCE_PATH}
${VXL_INCLUDE_DIRS}
)
# Main library
#ADD_EXECUTABLE(obliquePlane ${HEADERS} ${SOURCES})
ADD_LIBRARY(ObliquePlaneWrapper SHARED ${HEADERS} ${SOURCES})
TARGET_LINK_LIBRARIES(ObliquePlaneWrapper ${LINK_LIBRARIES} ${ITK_LIBRARIES})
I manually set this property in the All_build project and the corresponding .proj file. When i build the project it is searching for the ObliquePlaneWrapper.dll which it should be generating. Is this a problem because of some flag not set for common language runtime support
You can manually supply Compile Flags to specific sources to be compiled with specific flags. This includes \CLR for Visual C++. See example here.
https://cmake.org/pipermail/cmake/2011-April/043773.html
I have compiled program with cmake.The cmakelist.txt:
cmake_minimum_required (VERSION 2.6)
project (clustering)
IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
SET(LIB_SUFFIX "")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4)
SET(LIB_SUFFIX 64)
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
find_package(Eigen2 REQUIRED)
include_directories(${Eigen2_INCLUDE_DIR})
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif(NOT CMAKE_BUILD_TYPE)
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set(LIB_NAME clusteringd)
else(CMAKE_BUILD_TYPE MATCHES "Debug")
set(LIB_NAME clustering)
endif(CMAKE_BUILD_TYPE MATCHES "Debug")
file(GLOB LIB_PUBLIC_HEADERS "${CMAKE_SOURCE_DIR}/*.h")
file(GLOB LIB_SOURCES "${CMAKE_SOURCE_DIR}/*.cpp")
#add_library (${LIB_NAME}-s STATIC ${LIB_PUBLIC_HEADERS} ${LIB_SOURCES})
add_library (${LIB_NAME} SHARED ${LIB_PUBLIC_HEADERS} ${LIB_SOURCES})
install(
TARGETS ${LIB_NAME}
LIBRARY DESTINATION lib${LIB_SUFFIX}
)
#install(
# TARGETS ${LIB_NAME}-s
# ARCHIVE DESTINATION lib${LIB_SUFFIX}
#)
install(
FILES ${LIB_PUBLIC_HEADERS}
DESTINATION include/${LIB_NAME}
)
The problem is that in my folder /clusteringmaster/build/CMakeFiles/2.8.12.2/ I have two folders CompilerIdC and CompilerIdCXX,both of them have exe file.As Sergey pointed out exe should be located in bin directory.When I list my CmakeFile
2.8.12.2 cmake.check_cache CMakeOutput.log Makefile2 progress.marks
clustering.dir CMakeDirectoryInformation.cmake CMakeTmp Makefile.cmake TargetDirectories.txt
From the authors tutorial
Build
You will need the Eigen2 library (libeigen2-devel) and CMake (only tested under Linux).
$ mkdir release
$ cd release
$ cmake ../
$ make
Should I write cmake -- build /home/milenko/clusteing-master/release?
I have not worked with cmake before,how should I solve this confusion?
One item is that should use the cmake variable ${PROJECT_NAME} as the target name for the add_library command. (Your project name is specified as "clustering" because of the project (clustering) statement.) To get a d suffix for the debug configuration build, use set(CMAKE_DEBUG_POSTFIX d). I also like to set the output directory variables using
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
(I will even set the _DEBUG and _RELEASE variants, but this may cause problems when you are first getting started, so I would wait before doing that.)