Using a common Catch main object for development.#276
Using a common Catch main object for development.#276arcuru merged 7 commits intoexercism:masterfrom
Conversation
|
Ah, yes - you would need to name each library uniquely. Normally that's no issue, but in our case that is much harder to maintain. I think that we're correct to omit special compiler flags or definitions from catchlib: Looks pretty good at a read. Hope to try this in detail this evening. |
|
@patricksjackson I'm getting failures when I build individual exercises in isolation (using only the exercise-level Can you reproduce this: using something like: $ cd exercises/beer-song/
$ cmake . |
|
I think it's a quirk of CMake conditionals. When building from the root level, Reading through CMake's documentation on if() and variable references but haven't gotten to the bottom of it yet. |
|
Short story - got off in the weeds above. I think we need to reverse the order of the conditional for isolated exercises to build properly: # Use the common Catch library?
if(${EXERCISM_COMMON_CATCH})
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
endif()because |
|
There are some CMake if semantics here. I see this succeed: if(NOT EXERCISM_COMMON_CATCH)this fail: if(NOT ${EXERCISM_COMMON_CATCH})and this succeed: if(NOT "${EXERCISM_COMMON_CATCH}")Do you see something similar? This is when building as a student would - only one specific |
|
I alwyas like to work with CMake occasionally to remind me how much I hate it. That test is identical to the one elsewhere in the file that tests the run all tests option, except it has a I think the problem is CMake for evaluates the branch in some instances, even if it's not taken? No idea. Regardless, I added a test to CI to run it from an individual directory, and updated the exercise CMakeLists to what you suggested actually works. Also changing the title to WIP, I need to test this on Visual Studio because I now don't trust this will work everywhere, I'll change it back after confirming. |
|
Oh, I need to fix how I did the testing of an individual test anyways. |
This reverts commit 527425d.
|
Works fine in Visual Studio too. I added running the individual test in CI to #279, since it requires a compilable hello-world anyways. |
There's always Autotools ;)
I don't know for certain, but I think that |
KevinWMatthews
left a comment
There was a problem hiding this comment.
Good overall.
One possible change for consistency but it isn't required.
|
I missed that this was actually all finished apparently. I've updated after #284 and am merging.
Thankfully I've never had to touch Autotools, but it scares me anyways. |
* Implement armstrong numbers * Increased difficulty a bit * Made changes to the default CMakeLists.txt (based on PR #276) * Corrected vertical spacing. Used REQUIRE_FALSE for clarity * Corrected include guard * Made example solution more explicitly
This needed a few small changes from my hacked together test. Mostly I hit an issue where I couldn't create a
catchlibobject in every exercise during a full CMake build, so I had to switch how I did the individual exercise CMakeLists.txt files.I added some comments into the students' CMakeLists files, but they may need to be phrased better to be clearer to them. I wanted to explain what it was instead of just confusing the student if they looked at it.
Closes #272