build: move sqlite checking back to macros_and_definitions

This commit is contained in:
Gabriel Ferreira
2022-01-28 14:08:53 -03:00
parent 41aacec626
commit 6564afda68
2 changed files with 36 additions and 45 deletions

View File

@@ -485,6 +485,20 @@ macro(process_options)
endif()
endif()
set(ENABLE_SQLITE False)
if(${NS3_SQLITE})
find_package(
SQLite3
QUIET
)
if(${SQLite3_FOUND})
set(ENABLE_SQLITE True)
else()
message(STATUS SQLite was not found)
endif()
endif()
if(${NS3_NATIVE_OPTIMIZATIONS} AND ${GCC})
add_compile_options(-march=native -mtune=native)
endif()
@@ -935,6 +949,7 @@ macro(process_options)
check_include_file_cxx("stdlib.h" "HAVE_STDLIB_H")
check_include_file_cxx("signal.h" "HAVE_SIGNAL_H")
check_include_file_cxx("netpacket/packet.h" "HAVE_PACKETH")
check_include_file_cxx(semaphore.h HAVE_SEMAPHORE_H)
check_function_exists("getenv" "HAVE_GETENV")
configure_file(

View File

@@ -1,51 +1,27 @@
if(${NS3_SQLITE})
find_package(
SQLite3
QUIET
set(sqlite_sources)
set(sqlite_header)
set(sqlite_libraries)
if(${ENABLE_SQLITE})
set(sqlite_sources
model/sqlite-data-output.cc
)
check_include_file_cxx(
semaphore.h
HAVE_SEMAPHORE_H
set(sqlite_headers
model/sqlite-data-output.h
)
if(${SQLite3_FOUND})
set(sqlite_sources
model/sqlite-data-output.cc
include_directories(${SQLite3_INCLUDE_DIRS})
set(sqlite_libraries
${SQLite3_LIBRARIES}
)
if(HAVE_SEMAPHORE_H)
list(
APPEND
sqlite_sources
model/sqlite-output.cc
)
set(sqlite_headers
model/sqlite-data-output.h
)
include_directories(${SQLite3_INCLUDE_DIRS})
set(sqlite_libraries
${SQLite3_LIBRARIES}
)
if(HAVE_SEMAPHORE_H)
list(
APPEND
sqlite_sources
model/sqlite-output.cc
)
list(
APPEND
sqlite_headers
model/sqlite-output.h
)
endif()
endif()
mark_as_advanced(ENABLE_SQLITE)
if("${SQLite3_FOUND}")
set(ENABLE_SQLITE
True
CACHE INTERNAL
""
)
else()
set(ENABLE_SQLITE
False
CACHE INTERNAL
""
list(
APPEND
sqlite_headers
model/sqlite-output.h
)
endif()
endif()