Skip to content

Commit

Permalink
Merge pull request #40 from andreacasalino/BetterCmakeNames
Browse files Browse the repository at this point in the history
better cmake names
  • Loading branch information
andreacasalino authored Dec 15, 2023
2 parents 726fab5 + 2de98c0 commit 5a85f2e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")

project(EFG-Core)

set(EFG_LIB_NAME EFG-Core)
add_subdirectory(src)

option(BUILD_EFG_SAMPLES "Build the samples showing how to use EFG" ON)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ FetchContent_MakeAvailable(efg)
and then link to the **EFG** library:
```cmake
target_link_libraries(${THE NAME OF THE TARGET NEEDING EFG}
EFG
EFG-Core
)
```
### TRAINING CAPABILITIES
Expand Down
4 changes: 2 additions & 2 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# add_executable(ReadMe ReadMe.cpp)
# target_link_libraries(ReadMe PUBLIC EFG)
# target_link_libraries(ReadMe PUBLIC ${EFG_LIB_NAME})

add_subdirectory(Helpers)

function(SetUpSample NAME_)
target_link_libraries(${NAME_} PUBLIC EFG)
target_link_libraries(${NAME_} PUBLIC ${EFG_LIB_NAME})

target_link_libraries(${NAME_} PUBLIC Samples-Helpers)

Expand Down
2 changes: 1 addition & 1 deletion samples/Helpers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ file(GLOB SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/

add_library(${PROJECT_SHORTNAME} ${SRC_FILES})

target_link_libraries(${PROJECT_SHORTNAME} PUBLIC EFG)
target_link_libraries(${PROJECT_SHORTNAME} PUBLIC ${EFG_LIB_NAME})

target_include_directories(${PROJECT_SHORTNAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
12 changes: 5 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
set(PROJECT_SHORTNAME "EFG")

MakeLibrary(${PROJECT_SHORTNAME} header)
MakeLibrary(${EFG_LIB_NAME} header)

find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_SHORTNAME} PRIVATE
target_link_libraries(${EFG_LIB_NAME} PRIVATE
Threads::Threads
)
option(BUILD_EFG_COMPILER_CHECK "Enable extra compiler checks" OFF)
if(BUILD_EFG_COMPILER_CHECK)
target_compile_options(${PROJECT_SHORTNAME} PRIVATE -Wall -Wextra -Wpedantic -Werror)
target_compile_options(${EFG_LIB_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror)
endif()

function(LinkAndFlag DEP_LIB_NAME FLAG_NAME)
target_link_libraries(${PROJECT_SHORTNAME} PUBLIC ${DEP_LIB_NAME})
target_compile_definitions(${PROJECT_SHORTNAME} PUBLIC
target_link_libraries(${EFG_LIB_NAME} PUBLIC ${DEP_LIB_NAME})
target_compile_definitions(${EFG_LIB_NAME} PUBLIC
${FLAG_NAME}=1
)
endfunction()
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ add_executable(${TEST_NAME} ${SOURCES})
target_link_libraries(${TEST_NAME} PUBLIC
Catch2::Catch2
Catch2::Catch2WithMain
EFG
${EFG_LIB_NAME}
)

install(TARGETS ${TEST_NAME})
Expand Down

0 comments on commit 5a85f2e

Please sign in to comment.