Comments (3)
Hi @nyronium , thanks for the detailed description! I've tried to add a library definition as you've described, but I'm not really experienced with cmake so I'm not sure if it works as it should. Can you give it a try? It's only in master for now.
from robin-hood-hashing.
@martinus Thanks for implementing this, I really appreciate it! Your changes are mostly fine, though there are just two small things that kind of prevent using your library properly. Both of them are easily fixed though.
Wrong compile option
target_compile_features(robin_hood INTERFACE ${RH_cxx_standard})
This line breaks compilation, as it requests a feature called "14", which is not a thing.
To do this properly, use cxx_std_14
instead of ${RH_cxx_standard}
. Usually you don't have to store the required standard in a variable, as it can be deduced from the dependencies of a target and its compile options.
-target_compile_features(robin_hood INTERFACE ${RH_cxx_standard})
+target_compile_features(robin_hood INTERFACE cxx_std_14)
cxx_std_14 is a compile_feature offered by cmake to require c++14 for your target.
This is where it would come in handy if you had used the target in your local tests.
Then you could completely delete the RH_cxx_standard
variable, and CMake would figure it out automatically.
Global CMAKE state
set(CMAKE_CXX_STANDARD ${RH_cxx_standard})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Setting global cmake variables is generally not a good practice, as it alters the global state for the whole project, not just for your definitions. In this case it will change the default standard for newly created targets, disable fallback to older standards and disable the use of any c++ extensions (such as gnu++14, ...).
Either way you can (and should) completely delete these lines, and instead either use the exported target as a dependency in your test target, or alternatively you can simply replace ${RH_cxx_standard}
with cxx_std_14
in your test CMake files.
FYI (CMake intro)
I can understand that CMake does not seem very intuitive in the beginning, so
as you have said that you are not really experienced in CMake, I really want to recommend you to read through this short Introduction to modern CMake.
Especially the paragraphs "Dos and Don'ts", and "How to structure your project" might provide some useful insights.
I think adhering to some of those rules could both greatly simplify your setup and make it intuitive for other CMake users to use your project.
Even in case you don't want to change your structure, it will certainly give you a good understanding of basic CMake and why things are usually done a certain way. I hope you'll find useful!
from robin-hood-hashing.
Ok I think I got it now. I've got a minimal example in src/external_cmake
that makes use of the library, and it seems to work for me. Thanks again!
from robin-hood-hashing.
Related Issues (20)
- Segmentation fault: 11 with std::this_thread::get_id(); as key in C++ HOT 5
- Idea for robin-hood-hashing V2 HOT 1
- Keys are not marked as const when used structured binding during iteration over container HOT 2
- My problem with robin_hood::erase HOT 4
- robin_hoodConfig.cmake missing HOT 4
- terminate called after throwing an instance of 'std::overflow_error' what(): robin_hood::map overflow Aborted (core dumped) HOT 5
- hope to support bazel HOT 1
- How can I further improve performance in a read-only load? HOT 2
- func unaligned_load can be optimized HOT 2
- Please only build tests when BUILD_TESTING=ON HOT 1
- undefined symbol: std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<<<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) HOT 1
- Project doesn't install anything HOT 1
- Possible Data Corruption Bug? HOT 2
- Potentially critical bug in Robin Hood invariant checking HOT 4
- does insert support std::pair? HOT 1
- Consider using `INTERFACE_SYSTEM_INCLUDE_DIRECTORIES`
- Explicit template instantiation
- There is a coredump if I defined <std::string, std::shared_ptr<void>> when a pointer delete
- intel compiler warnings (not a bug)
- crash because alignment of key is not respected HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from robin-hood-hashing.