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

cmake: declare project() ASAP after cmake_minimum_required() & use c_std_99 compile feature #641

Merged
merged 2 commits into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
inject C99 through compile feature
it's a hard requirement to compile at least with C99, so it shouldn't be delegated to an optional toolchain file
  • Loading branch information
SpaceIm committed Aug 17, 2022
commit 310a37ecc41629ce6c3a64a2876c0960361fcfe7
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ set(CMAKE_MACOSX_RPATH 1)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/toolchain.cmake"
CACHE FILEPATH
"Toolchain to use for building this project")

# Some misc apps do not work with shared libraries on Windows
# because they require access to internal H3 functions. Build these
Expand Down Expand Up @@ -269,6 +266,7 @@ function(add_h3_library name h3_alloc_prefix_override)

target_compile_options(${name} PRIVATE ${H3_COMPILE_FLAGS})
target_link_libraries(${name} PRIVATE ${H3_LINK_FLAGS})
target_compile_features(${name} PUBLIC c_std_99)

find_library(M_LIB m)
if(M_LIB)
Expand Down
16 changes: 0 additions & 16 deletions cmake/toolchain.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ set(EXAMPLES
edge)

set(EXECUTABLE_OUTPUT_PATH bin)
link_libraries(h3::h3)

# Build each example
foreach(name ${EXAMPLES})
add_executable(${name} "${name}.c")
target_link_libraries(${name} PRIVATE h3::h3)
endforeach()

# Testing the examples
Expand Down