Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Commit

Permalink
CMakeLists.txt, with an example
Browse files Browse the repository at this point in the history
  • Loading branch information
martinus committed Nov 10, 2019
1 parent 22be9cf commit a1a8905
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
cmake_minimum_required(VERSION 3.5)
project(robin-hood-hashing LANGUAGES CXX)

# determine whether this is a standalone project or included by other projects
set(RH_STANDALONE_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(RH_STANDALONE_PROJECT ON)
endif ()

if (RH_STANDALONE_PROJECT)
cmake_minimum_required(VERSION 3.5)
project(robin-hood-hashing LANGUAGES CXX)

option(RH_sanitizer "Address sanitizer" OFF)
option(RH_coverage "Enable coverage" OFF)
set(RH_cxx_standard "14" CACHE STRING "C++ standard, e.g. 11, 14, 17")
Expand Down
1 change: 1 addition & 0 deletions src/external_cmake/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
15 changes: 15 additions & 0 deletions src/external_cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# see https://cliutils.gitlab.io/modern-cmake/chapters/basics.html
cmake_minimum_required(VERSION 3.1...3.15)

if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()


project(MyProject VERSION 1.0
DESCRIPTION "Very nice project"
LANGUAGES CXX)
add_subdirectory("${PROJECT_SOURCE_DIR}/../.." "extern/robin_hood")

add_executable(MyProject myproject.cpp)
target_link_libraries(MyProject robin_hood)
8 changes: 8 additions & 0 deletions src/external_cmake/myproject.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <iostream>
#include <robin_hood.h>

int main(int, char**) {
robin_hood::unordered_flat_map<int, int> map;
map[1] = 123;
std::cout << "hello, world! " << map.size() << std::endl;
}

0 comments on commit a1a8905

Please sign in to comment.