forked from cozybit/authsae
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is just mirroring the way the linux Makefiles handled things. libnl on Openwrt is no longer a special case, we pick up LDFLAGS through pkg-config. This does not support cmake on freebsd, although an extra case on the CMAKE_SYSTEM_NAME conditional could be easily used to handle freebsd.
- Loading branch information
1 parent
65f03a3
commit d769598
Showing
2 changed files
with
163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
CMAKE_MINIMUM_REQUIRED (VERSION 2.8) | ||
PROJECT (AUTHSAE C) | ||
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) | ||
|
||
##################################################################### | ||
INCLUDE(FindPkgConfig) | ||
IF(NOT PKG_CONFIG_FOUND) | ||
MESSAGE(FATAL_ERROR "Error: pkg-config not found on this system") | ||
ENDIF(NOT PKG_CONFIG_FOUND) | ||
|
||
##################################################################### | ||
MESSAGE(STATUS "") | ||
MESSAGE(STATUS "Configuring Host System and compiler flags ...") | ||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
ADD_DEFINITIONS(-g) | ||
ADD_DEFINITIONS(-DLINUX) | ||
ADD_DEFINITIONS(-Wall) | ||
ADD_DEFINITIONS(-Werror) | ||
|
||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) | ||
LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}) | ||
|
||
ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
MESSAGE(FATAL_ERROR "Unsupported system ${CMAKE_SYSTEM_NAME}") | ||
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
|
||
##################################################################### | ||
MESSAGE(STATUS "") | ||
MESSAGE(STATUS "Configuring libcrypto ...") | ||
|
||
PKG_CHECK_MODULES(LIBCRYPTO REQUIRED libcrypto) | ||
IF(LIBCRYPTO_FOUND) | ||
INCLUDE_DIRECTORIES(${LIBCRYPTO_INCLUDE_DIRS}) | ||
LINK_DIRECTORIES(${LIBCRYPTO_LIB_DIRS}) | ||
ENDIF(LIBCRYPTO_FOUND) | ||
|
||
##################################################################### | ||
MESSAGE(STATUS "") | ||
MESSAGE(STATUS "Configuring libconfig ...") | ||
|
||
PKG_CHECK_MODULES(LIBCONFIG REQUIRED libconfig>=1.3) | ||
IF(LIBCONFIG_FOUND) | ||
INCLUDE_DIRECTORIES(${LIBCONFIG_INCLUDE_DIRS}) | ||
LINK_DIRECTORIES(${LIBCONFIG_LIB_DIRS}) | ||
ENDIF(LIBCONFIG_FOUND) | ||
|
||
##################################################################### | ||
MESSAGE(STATUS "") | ||
MESSAGE(STATUS "Configuring libsae ...") | ||
|
||
LIST(APPEND libsae_libs | ||
${LIBCONFIG_LIBRARIES} | ||
${LIBCRYPTO_LIBRARIES} | ||
) | ||
|
||
LIST(APPEND libsae_sources | ||
common.c | ||
sae.c | ||
service.c | ||
ampe.c | ||
crypto/aes_siv.c | ||
) | ||
|
||
ADD_LIBRARY(sae ${libsae_sources}) | ||
TARGET_LINK_LIBRARIES(sae ${libsae_libs}) | ||
|
||
##################################################################### | ||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
ADD_SUBDIRECTORY(linux) | ||
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
|
||
##################################################################### | ||
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/config/authsae.sample.cfg" "/etc/authsae.cfg" COPYONLY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
##################################################################### | ||
INCLUDE(FindPkgConfig) | ||
IF(NOT PKG_CONFIG_FOUND) | ||
MESSAGE(FATAL_ERROR "Error: pkg-config not found on this system") | ||
ENDIF(NOT PKG_CONFIG_FOUND) | ||
|
||
##################################################################### | ||
MESSAGE(STATUS "") | ||
MESSAGE(STATUS "Configuring libnl ...") | ||
|
||
PKG_SEARCH_MODULE(LIBNL libnl>=2.0 libnl-2.0 libnl-2) | ||
IF(LIBNL_FOUND) | ||
INCLUDE_DIRECTORIES(${LIBNL_INCLUDE_DIRS}) | ||
LINK_DIRECTORIES(${LIBNL_LIB_DIRS}) | ||
ELSE(LIBNL_FOUND) | ||
PKG_SEARCH_MODULE(LIBNL3 libnl-3 libnl-3.0) | ||
IF(LIBNL3_FOUND) | ||
INCLUDE_DIRECTORIES(${LIBNL3_INCLUDE_DIRS}) | ||
LINK_DIRECTORIES(${LIBNL3_LIB_DIRS}) | ||
SET(LIBNL_LIBRARIES ${LIBNL3_LIB_DIRS}) | ||
|
||
############################################################# | ||
MESSAGE(STATUS "") | ||
MESSAGE(STATUS "Configuring libnl-genl ...") | ||
|
||
PKG_SEARCH_MODULE(LIBNL_GENL REQUIRED libnl-genl>=2.0 libnl-genl-3 libnl-genl-3.0) | ||
IF(LIBNL_GENL_FOUND) | ||
INCLUDE_DIRECTORIES(${LIBNL_GENL_INCLUDE_DIRS}) | ||
LINK_DIRECTORIES(${LIBNL_GENL_LIB_DIRS}) | ||
ENDIF(LIBNL_GENL_FOUND) | ||
ELSE(LIBNL3_FOUND) | ||
MESSAGE(FATAL_ERROR "Error: libnl and libnl-genl not found") | ||
ENDIF(LIBNL3_FOUND) | ||
ENDIF(LIBNL_FOUND) | ||
|
||
##################################################################### | ||
MESSAGE(STATUS "") | ||
MESSAGE(STATUS "Configuring mon ...") | ||
|
||
LIST(APPEND mon_sources | ||
mon.c | ||
../service.c | ||
../common.c | ||
) | ||
|
||
ADD_EXECUTABLE(mon ${mon_sources}) | ||
INSTALL(TARGETS mon DESTINATION bin) | ||
|
||
##################################################################### | ||
MESSAGE(STATUS "") | ||
MESSAGE(STATUS "Configuring meshd ...") | ||
|
||
LIST(APPEND meshd_libs | ||
${LIBCONFIG_LIBRARIES} | ||
${LIBCRYPTO_LIBRARIES} | ||
sae | ||
) | ||
|
||
LIST(APPEND meshd_sources | ||
meshd.c | ||
../common.c | ||
../service.c | ||
../ampe.c | ||
../crypto/aes_siv.c | ||
) | ||
|
||
ADD_EXECUTABLE(meshd ${meshd_sources}) | ||
TARGET_LINK_LIBRARIES(meshd ${meshd_libs}) | ||
INSTALL(TARGETS meshd DESTINATION bin) | ||
|
||
##################################################################### | ||
MESSAGE(STATUS "") | ||
MESSAGE(STATUS "Configuring meshd-nl80211 ...") | ||
|
||
LIST(APPEND meshd_nl80211_libs | ||
${LIBCONFIG_LIBRARIES} | ||
${LIBCRYPTO_LIBRARIES} | ||
${LIBNL_LIBRARIES} | ||
${LIBNL_GENL_LIBRARIES} | ||
sae | ||
) | ||
|
||
LIST(APPEND meshd_nl80211_sources | ||
meshd-nl80211.c | ||
nlutils.c | ||
) | ||
|
||
ADD_EXECUTABLE(meshd-nl80211 ${meshd_nl80211_sources}) | ||
TARGET_LINK_LIBRARIES(meshd-nl80211 ${meshd_nl80211_libs}) | ||
INSTALL(TARGETS meshd-nl80211 DESTINATION bin) |