summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2021-01-13 12:15:22 +0100
committerFilip Gawin <filip.gawin@zoho.com>2021-01-13 12:15:22 +0100
commit4097c20bdd66d03e0be454f1834e2d1bd4c54443 (patch)
treee4f2954479e5d899f05f7f6394158ae5e6320d57 /src/CMakeLists.txt
parentfb1bd1a5bd3ed6de91e4e86dd0ff9ae22d55dff6 (diff)
Make cmake files more generic
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2f663061..dc204d17 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,7 +1,7 @@
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
-file(GLOB_RECURSE RE3_SOURCES "*.cpp" "*.h" "*.rc")
+file(GLOB_RECURSE ${PROJECT}_SOURCES "*.cpp" "*.h" "*.rc")
function(header_directories RETURN_LIST)
file(GLOB_RECURSE ALL_SRCS *.h *.cpp *.c)
@@ -15,77 +15,77 @@ function(header_directories RETURN_LIST)
set(${RETURN_LIST} ${RELDIRS} PARENT_SCOPE)
endfunction()
-header_directories(RE3_INCLUDES)
+header_directories(${PROJECT}_INCLUDES)
-add_executable(re3 WIN32
- ${RE3_SOURCES}
+add_executable(${EXECUTABLE} WIN32
+ ${${PROJECT}_SOURCES}
)
-target_link_libraries(re3 PRIVATE
+target_link_libraries(${EXECUTABLE} PRIVATE
librw::librw
Threads::Threads
)
-target_include_directories(re3
+target_include_directories(${EXECUTABLE}
PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
- $<BUILD_INTERFACE:${RE3_INCLUDES}>
+ $<BUILD_INTERFACE:${${PROJECT}_INCLUDES}>
)
-target_compile_definitions(re3
+target_compile_definitions(${EXECUTABLE}
PRIVATE
$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>
LIBRW
- RE3_NO_AUTOLINK
+ ${PROJECT}_NO_AUTOLINK
)
if(LIBRW_PLATFORM_D3D9)
- target_compile_definitions(re3
+ target_compile_definitions(${EXECUTABLE}
PUBLIC
USE_D3D9
)
endif()
-if(RE3_AUDIO STREQUAL "OAL")
+if(${PROJECT}_AUDIO STREQUAL "OAL")
find_package(OpenAL REQUIRED)
- target_include_directories(re3 PRIVATE ${OPENAL_INCLUDE_DIR})
- target_link_libraries(re3 PRIVATE ${OPENAL_LIBRARY})
- target_compile_definitions(re3 PRIVATE ${OPENAL_DEFINITIONS})
- target_compile_definitions(re3 PRIVATE AUDIO_OAL)
-elseif(RE3_AUDIO STREQUAL "MSS")
+ target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR})
+ target_link_libraries(${EXECUTABLE} PRIVATE ${OPENAL_LIBRARY})
+ target_compile_definitions(${EXECUTABLE} PRIVATE ${OPENAL_DEFINITIONS})
+ target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL)
+elseif(${PROJECT}_AUDIO STREQUAL "MSS")
find_package(MilesSDK REQUIRED)
- target_compile_definitions(re3 PRIVATE AUDIO_MSS)
- target_link_libraries(re3 PRIVATE MilesSDK::MilesSDK)
+ target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_MSS)
+ target_link_libraries(${EXECUTABLE} PRIVATE MilesSDK::MilesSDK)
endif()
find_package(mpg123 REQUIRED)
-target_link_libraries(re3 PRIVATE
+target_link_libraries(${EXECUTABLE} PRIVATE
MPG123::libmpg123
)
-if(RE3_WITH_OPUS)
+if(${PROJECT}_WITH_OPUS)
find_package(opusfile REQUIRED)
- target_link_libraries(re3 PRIVATE
+ target_link_libraries(${EXECUTABLE} PRIVATE
opusfile::opusfile
)
- target_compile_definitions(re3 PRIVATE AUDIO_OPUS)
+ target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OPUS)
endif()
-if(RE3_WITH_LIBSNDFILE)
+if(${PROJECT}_WITH_LIBSNDFILE)
find_package(SndFile REQUIRED)
- target_link_libraries(re3 PRIVATE
+ target_link_libraries(${EXECUTABLE} PRIVATE
SndFile::SndFile
)
- target_compile_definitions(re3 PRIVATE AUDIO_OAL_USE_SNDFILE)
+ target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL_USE_SNDFILE)
endif()
-target_compile_definitions(re3 PRIVATE )
+target_compile_definitions(${EXECUTABLE} PRIVATE )
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
- target_compile_options(re3
+ target_compile_options(${EXECUTABLE}
PRIVATE
"-Wall"
)
if (NOT LIBRW_PLATFORM_PS2)
- target_compile_options(re3
+ target_compile_options(${EXECUTABLE}
PRIVATE
-Wextra
-Wdouble-promotion
@@ -93,13 +93,13 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang
)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
- target_compile_options(re3
+ target_compile_options(${EXECUTABLE}
PUBLIC
/Zc:sizedDealloc-
)
endif()
-set_target_properties(re3
+set_target_properties(${EXECUTABLE}
PROPERTIES
C_STANDARD 11
C_EXTENSIONS OFF
@@ -109,13 +109,13 @@ set_target_properties(re3
CXX_STANDARD_REQUIRED ON
)
-if(RE3_INSTALL)
+if(${PROJECT}_INSTALL)
install(
- TARGETS re3
- EXPORT re3-targets
+ TARGETS ${EXECUTABLE}
+ EXPORT ${EXECUTABLE}-targets
RUNTIME DESTINATION "."
)
if(MSVC)
- install(FILES $<TARGET_PDB_FILE:re3> DESTINATION "." OPTIONAL)
+ install(FILES $<TARGET_PDB_FILE:${EXECUTABLE}> DESTINATION "." OPTIONAL)
endif()
endif()