Create a project like this. Only CMakeLists.txt really matters. The other files just have to be there and have valid code.
CMakeLists.txt like this
==================
cmake_minimum_required(VERSION 3.5)
project(crash)
option(test "build tests" OFF)
add_library(crash
source/lib.cpp
)
if(test)
add_executable(unittest test/test.cpp)
endif(test)
==================
source/lib.cpp
==================
int add(int a, int b) {
return a + b;
}
==================
test/test.cpp
==================
int main() {
return 0;
}
==================
Proceed this steps:
1. Project -> Prune Selection
2. Project -> Configure Selection
3. Project -> Open Configuration...
4. Enable custom "test" cmake option
5. Click on OK -> segfault without path; no segfault with patch