OSGeo / shapelib

Official repository of shapelib
Other
141 stars 66 forks source link

CMake: Add GTA Run Settings #144

Closed thbeu closed 3 months ago

thbeu commented 3 months ago

This PR generates the Run Settings file for the GoogleTestAdapter (GTA) with the expected working directory to run the GoogleTest based unit tests from Test Explorer in Visual Studio.

image

Resolves #143

rouault commented 3 months ago

I'm a bit skeptical about such a IDE specific setting. Isn't rather the issue the WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" at line 31 of tests/CMakeLists.txt that should be instead ${CMAKE_SOURCE_DIR}/tests ?

thbeu commented 3 months ago

Isn't rather the issue the WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" at line 31 of tests/CMakeLists.txt that should be instead ${CMAKE_SOURCE_DIR}/tests ?

According to all my many tries and the cited issue #143 there is no such CMake only fix to get the GTA running with proper working directory.

rouault commented 3 months ago

hum, but I'm puzzled by the discrepency between the existing ${PROJECT_SOURCE_DIR} in tests/CMakeLists.txt and @CMAKE_SOURCE_DIR@/tests in the new file of this PR. Any explanation why they don't match?

thbeu commented 3 months ago

hum, but I'm puzzled by the discrepency between the existing ${PROJECT_SOURCE_DIR} in tests/CMakeLists.txt and @CMAKE_SOURCE_DIR@/tests in the new file of this PR. Any explanation why they don't match?

PROJECT_SOURCE_DIR of /tests/ subdir is the same as CMAKE_SOURCE_DIR/tests.

OK, fixed it. Now it relies on configure_file being called from /tests/CMakeLists.txt project.

Alternatively a UNITTEST_DIR variable could be introduced.

rouault commented 3 months ago

PROJECT_SOURCE_DIR of /tests/ subdir is the same as CMAKE_SOURCE_DIR/tests.

oh, I missed that tests/CMakeLists.txt defined a new project()...

The new file should also be listed in EXTRA_DIST of top Makefile.am

thbeu commented 3 months ago

The new file should also be listed in EXTRA_DIST of top Makefile.am

I already did.