Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build errors on macOS #950

Merged
merged 2 commits into from
Sep 21, 2023
Merged

Conversation

stognini
Copy link
Member

This PR fixes two build errors on macOS:

test/testdetail/TestMacrosImpl.cc:19:14: fatal error: 'nlohmann/json.hpp' file not found
#    include <nlohmann/json.hpp>
             ^~~~~~~~~~~~~~~~~~~
app/celer-g4/TimerOutput.hh:34:29: error: no template named 'unordered_map' in namespace 'std'
    using MapStrReal = std::unordered_map<std::string, real_type>;
                       ~~~~~^

@stognini stognini requested a review from sethrj September 20, 2023 21:53
@stognini stognini added bug Something isn't working minor Minor internal changes or fixes labels Sep 20, 2023
celeritas_target_link_libraries(testcel_harness
PUBLIC nlohmann_json::nlohmann_json
)
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The include_directories isn't necessary because the modern cmake targets propagate that information
  • This should be PRIVATE not PUBLIC because it's only used in a .cc file
  • if ( -> if(
  • Our top-level cmakelists defines nlohmann_json_LIBRARIES so that it's empty if json isn't available, so that makes it easier to add for the optional cases
  • It turns out I'm not directly using JSON anyway for now, so we could've just deleted the include 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, so target_link_libraries(...) sets the include dirs as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. Modern cmake targets propagate build flags, library flags, include directories, etc.

@pcanal pcanal self-requested a review September 21, 2023 12:58
@sethrj sethrj merged commit 1596c76 into celeritas-project:develop Sep 21, 2023
@sethrj sethrj removed the bug Something isn't working label Sep 21, 2023
@sethrj sethrj added the core Software engineering infrastructure label Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Software engineering infrastructure minor Minor internal changes or fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants