saprykin / plibsys

Highly portable C system library: threads and synchronization primitives, sockets (TCP, UDP, SCTP), IPv4 and IPv6, IPC, hash functions (MD5, SHA-1, SHA-2, SHA-3, GOST), binary trees (RB, AVL) and more. Native code performance.
MIT License
672 stars 74 forks source link

Use CMAKE_CURRENT_BINARY_DIR instead of CMAKE_BINARY_DIR #76

Closed Qix- closed 1 year ago

Qix- commented 5 years ago

Otherwise, you pollute the project's build directory with a bunch of random stuff, which isn't very fun. 🙃

codecov-io commented 5 years ago

Codecov Report

Merging #76 into master will decrease coverage by <1%. The diff coverage is n/a.

@@          Coverage Diff          @@
##           master    #76   +/-   ##
=====================================
- Coverage      88%    88%   -1%     
=====================================
  Files          41     41           
  Lines        3853   3854    +1     
=====================================
- Hits         3426   3422    -4     
- Misses        427    432    +5
saprykin commented 5 years ago

@Qix- , Thank you for the patch. Apparently, CMAKE_BINARY_DIR is also used for the tests, therefore it shall be adjusted there as well.

For me, the use of CMAKE_BINARY_DIR for output brings some advantages like a ready-to-deploy build folder, or that you can run compiled project directly from the build directory. I also understand that such a behaviour may be not beneficial for other projects. Therefore, I still want to keep a possibility to output compiled library into the top build directory.

I'm thinking about adding an option to control the output binary dir - either into the current binary directory, or into the top one. Any other suggestions how it could be done in a proper CMake-way?

Qix- commented 5 years ago

@saprykin using CMAKE_BINARY_DIR is wrong pretty much in every scenario. I'd argue it should be deprecated from CMake entirely as it breaks hierarchical builds. Please do not use it.

saprykin commented 1 year ago

Okay, implemented in ac23d0a3c22eb3425a414366e401a8a2e5b3bda3.