✅ Added unit-tests
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
# Run cmake with -DVARNAME=ON/OFF to benefit from those
|
||||
# possible settings.
|
||||
#-------------------------------------------------------
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(moFileReader)
|
||||
|
||||
# The main include directory
|
||||
@ -22,39 +22,28 @@ include_directories(BEFORE ${CMAKE_SOURCE_DIR}/include)
|
||||
# Let the user choose between static lib and dll
|
||||
# To use it, call cmake -DCOMPILE_DLL=ON
|
||||
option(COMPILE_DLL "Set this to ON if you want to compile the library as an DLL. When this is OFF, a static library is created (default)." OFF)
|
||||
|
||||
|
||||
if ( NOT COMPILE_DLL )
|
||||
|
||||
# Static build
|
||||
add_library(moFileReader.static STATIC ${CMAKE_SOURCE_DIR}/src/moFileReader.cpp ${CMAKE_SOURCE_DIR}/src/mo.cpp)
|
||||
|
||||
else ( COMPILE_DLL )
|
||||
|
||||
if (COMPILE_DLL)
|
||||
# DLL
|
||||
add_definitions(-D_USRDLL -DMOFILE_EXPORTS)
|
||||
add_library(moFileReader SHARED ${CMAKE_SOURCE_DIR}/src/moFileReader.cpp ${CMAKE_SOURCE_DIR}/src/mo.cpp)
|
||||
|
||||
target_compile_definitions(moReader PRIVATE _USRDLL MOFILE_EXPORTS)
|
||||
endif ()
|
||||
|
||||
add_library(moFileReader STATIC ${CMAKE_SOURCE_DIR}/src/moFileReader.cpp ${CMAKE_SOURCE_DIR}/src/mo.cpp)
|
||||
add_executable(moReader ${CMAKE_SOURCE_DIR}/src/mo.cpp)
|
||||
|
||||
if ( NOT COMPILE_DLL )
|
||||
if (COMPILE_DLL)
|
||||
target_compile_definitions(moReader PRIVATE _CONSOLE MOFILE_IMPORT)
|
||||
else ()
|
||||
target_compile_definitions(moReader PRIVATE _CONSOLE)
|
||||
endif ()
|
||||
|
||||
add_definitions(-D_CONSOLE)
|
||||
add_dependencies(moReader moFileReader.static)
|
||||
target_link_libraries(moReader moFileReader.static)
|
||||
|
||||
else ( COMPILE_DLL )
|
||||
|
||||
add_definitions(-D_CONSOLE -DMOFILE_IMPORT)
|
||||
add_dependencies(moReader moFileReader)
|
||||
target_link_libraries(moReader moFileReader)
|
||||
|
||||
endif ()
|
||||
|
||||
|
||||
|
||||
option(BUILD_TEST "Set this to ON if you want to build the test" OFF)
|
||||
|
||||
if(BUILD_TEST)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user