diff --git a/reformatter/CMakeLists.txt b/reformatter/CMakeLists.txt index 52a9bee8..e6308512 100644 --- a/reformatter/CMakeLists.txt +++ b/reformatter/CMakeLists.txt @@ -26,7 +26,7 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib) ADD_EXECUTABLE(json_reformat ${SRCS}) -TARGET_LINK_LIBRARIES(json_reformat yajl_s) +TARGET_LINK_LIBRARIES(json_reformat yajl_s m) # In some environments, we must explicitly link libm (like qnx, # thanks @shahbag) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 99cf9e95..0887e9ef 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,13 +30,15 @@ ADD_DEFINITIONS(-DYAJL_BUILD) # set up some paths SET (libDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib) SET (incDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/include/yajl) -SET (shareDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/share/pkgconfig) +SET (pcDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib/pkgconfig) # set the output path for libraries SET(LIBRARY_OUTPUT_PATH ${libDir}) ADD_LIBRARY(yajl_s STATIC ${SRCS} ${HDRS} ${PUB_HDRS}) +SET_TARGET_PROPERTIES(yajl_s PROPERTIES OUTPUT_NAME yajl) +IF(BUILD_SHARED_LIBS) ADD_LIBRARY(yajl SHARED ${SRCS} ${HDRS} ${PUB_HDRS}) #### setup shared library version number @@ -44,6 +46,7 @@ SET_TARGET_PROPERTIES(yajl PROPERTIES DEFINE_SYMBOL YAJL_SHARED SOVERSION ${YAJL_MAJOR} VERSION ${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO}) +ENDIF(BUILD_SHARED_LIBS) #### ensure a .dylib has correct absolute installation paths upon installation IF(APPLE) @@ -61,7 +64,7 @@ FILE(MAKE_DIRECTORY ${incDir}) # generate build-time source SET(dollar $) CONFIGURE_FILE(api/yajl_version.h.cmake ${incDir}/yajl_version.h) -CONFIGURE_FILE(yajl.pc.cmake ${shareDir}/yajl.pc) +CONFIGURE_FILE(yajl.pc.cmake ${pcDir}/yajl.pc) # copy public headers to output directory FOREACH (header ${PUB_HDRS}) @@ -77,11 +80,13 @@ INCLUDE_DIRECTORIES(${incDir}/..) # at build time you may specify the cmake variable LIB_SUFFIX to handle # 64-bit systems which use 'lib64' +IF(BUILD_SHARED_LIBS) INSTALL(TARGETS yajl RUNTIME DESTINATION lib${LIB_SUFFIX} LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX}) +ENDIF(BUILD_SHARED_LIBS) INSTALL(TARGETS yajl_s ARCHIVE DESTINATION lib${LIB_SUFFIX}) INSTALL(FILES ${PUB_HDRS} DESTINATION include/yajl) INSTALL(FILES ${incDir}/yajl_version.h DESTINATION include/yajl) -INSTALL(FILES ${shareDir}/yajl.pc DESTINATION share/pkgconfig) +INSTALL(FILES ${pcDir}/yajl.pc DESTINATION lib/pkgconfig) diff --git a/test/api/CMakeLists.txt b/test/api/CMakeLists.txt index cd65a542..e0ce2f64 100644 --- a/test/api/CMakeLists.txt +++ b/test/api/CMakeLists.txt @@ -21,5 +21,5 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../../${YAJL_DIST_NAME}/lib) FOREACH (test ${TESTS}) GET_FILENAME_COMPONENT(testProg ${test} NAME_WE) ADD_EXECUTABLE(${testProg} ${test}) - TARGET_LINK_LIBRARIES(${testProg} yajl) + TARGET_LINK_LIBRARIES(${testProg} yajl m) ENDFOREACH() diff --git a/test/parsing/CMakeLists.txt b/test/parsing/CMakeLists.txt index c22a3887..c37e5e5b 100644 --- a/test/parsing/CMakeLists.txt +++ b/test/parsing/CMakeLists.txt @@ -20,4 +20,4 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../../${YAJL_DIST_NAME}/lib) ADD_EXECUTABLE(yajl_test ${SRCS}) -TARGET_LINK_LIBRARIES(yajl_test yajl_s) +TARGET_LINK_LIBRARIES(yajl_test yajl_s m)