How do I force cmake to include “-pthread” option during compilation?

The Threads module in the latest versions (>= 3.1) of CMake generates the Threads::Threads imported target. Linking your target against Threads::Threads adds all the necessary compilation and linking flags. It can be done like this: set(CMAKE_THREAD_PREFER_PTHREAD TRUE) set(THREADS_PREFER_PTHREAD_FLAG TRUE) find_package(Threads REQUIRED) add_executable(test test.cpp) target_link_libraries(test Threads::Threads) Use of the imported target is highly recommended for new … Read more

Is there an automatic code formatter for C#? [closed]

For Visual Studio, take a look at ReSharper. It’s an awesome tool and a definite must-have. Versions after 4.0 have the code formatting and clean-up feature that you are looking for. There’s also plugin integration with StyleCop, including formatting settings file. You’ll probably want Agent Smith plugin as well, for spell-checking the identifiers and comments. … Read more

Can we execute a .bat file in post build event command line in visual studio?

Sure, here’s an example: call “$(SolutionDir)scripts\copyifnewer.bat” “$(SolutionDir)libs\RLPL.Services.CertificateValidator.Basic.dll” “$(TargetDir)RLPL.Services.CertificateValidator.Basic.dll” call “$(SolutionDir)scripts\copyifnewer.bat” “$(SolutionDir)libs\RLPL.Services.CertificateValidator.Common.dll” “$(TargetDir)RLPL.Services.CertificateValidator.Common.dll” Just be aware of two possible issues you might have: the enclosing double quotes (see how each part is surrounded by ” sign) if you want to call 2 or more batch files make sure you use call command otherwise you’ll have a … Read more

How can I get CMake to find my alternative Boost installation?

You should have a look at FindBoost.cmake script, which handles Boost detection and setting up all Boost variables. It typically resides in /usr/share/cmake-2.6/Modules/. In it, you will find documentation. For instance: # These last three variables are available also as environment variables: # # BOOST_ROOT or BOOSTROOT The preferred installation prefix for searching for # … Read more

Dump include paths from g++

From Jonathan Wakely a better option (works on clang too): g++ -E -x c++ – -v < /dev/null clang++ -E -x c++ – -v < /dev/null I noticed there’s a flag in cpp for specifying language. This works like a charm. cpp -xc++ -v < /dev/null #include “…” search starts here: #include <…> search starts … Read more

WiX 3.0 throws error 217, while being executed by continuous integration

End of the story: After fiddling with the permissions of the integration account, DCOM, service activation, etc. without any luck, I finally simply disabled ICE validation in the continuous integration build, while still keeping it in the local build. To disable ICE validation you can set SuppressValidation to true in the .wixproj file: <PropertyGroup> <SuppressValidation>true</SuppressValidation> … Read more

Why is there no need for Maven in .NET?

For artifact dependency resolving, I’d say Nuget is now the preferred alternative. It supports and promotes build time resolution, i.e. no need to check in binary dependency artifacts into vcs. See these articles. From version 2.7 of Nuget, build time resolution has even better support with the command Nuget restore being one of the options. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)