CMake: replace improperly used variables with correct ones.

CMake variables FLTK_SOURCE_DIR and FLTK_BINARY_DIR are only defined
if the project name is exactly "FLTK" (all uppercase). These variables
are generated (set) by CMake as <PROJECT_NAME>_SOURCE_DIR etc.

The correct variables are CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR,
respectively, which are always defined.

This commit enables future changes of the FLTK project name, e.g. to
"fltk" or "fltk-1.4.0" (a versioned project name), if we like...


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12281 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser 2017-06-29 17:51:27 +00:00
parent 7dc496e97d
commit 3eb6b7ea58
7 changed files with 44 additions and 43 deletions

View File

@ -46,39 +46,39 @@ export(TARGETS ${FLUID} ${FLTK_LIBRARIES} FILE ${CMAKE_BINARY_DIR}/FLTK-Targets.
# generate FLTKConfig.cmake for build directory use
set(INCLUDE_DIRS "${FLTK_INCLUDE_DIRS}")
set(CONFIG_PATH ${FLTK_BINARY_DIR})
set(CONFIG_PATH ${CMAKE_BINARY_DIR})
configure_file(
${FLTK_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
${FLTK_BINARY_DIR}/FLTKConfig.cmake
${CMAKE_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
${CMAKE_BINARY_DIR}/FLTKConfig.cmake
@ONLY
)
# generate UseFLTK.cmake for build directory use
configure_file(
${FLTK_SOURCE_DIR}/CMake/UseFLTK.cmake.in
${FLTK_BINARY_DIR}/UseFLTK.cmake
${CMAKE_SOURCE_DIR}/CMake/UseFLTK.cmake.in
${CMAKE_BINARY_DIR}/UseFLTK.cmake
@ONLY
)
# generate fltk-config for build directory use
set(prefix ${FLTK_BINARY_DIR})
set(prefix ${CMAKE_BINARY_DIR})
set(exec_prefix "\${prefix}")
set(includedir "${FLTK_SOURCE_DIR}")
set(BINARY_DIR "${FLTK_BINARY_DIR}")
set(includedir "${CMAKE_SOURCE_DIR}")
set(BINARY_DIR "${CMAKE_BINARY_DIR}")
set(libdir "\${exec_prefix}/lib")
set(srcdir ".")
set(LIBNAME "${libdir}/libfltk.a")
configure_file(
"${FLTK_SOURCE_DIR}/fltk-config.in"
"${FLTK_BINARY_DIR}/fltk-config"
"${CMAKE_SOURCE_DIR}/fltk-config.in"
"${CMAKE_BINARY_DIR}/fltk-config"
@ONLY
)
if(UNIX)
execute_process(COMMAND chmod 755 fltk-config
WORKING_DIRECTORY "${FLTK_BINARY_DIR}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
)
endif(UNIX)
@ -102,8 +102,8 @@ set(CONFIG_H config.h)
# generate config.h
configure_file(
"${FLTK_SOURCE_DIR}/${CONFIG_H_IN}"
"${FLTK_BINARY_DIR}/${CONFIG_H}"
"${CMAKE_SOURCE_DIR}/${CONFIG_H_IN}"
"${CMAKE_BINARY_DIR}/${CONFIG_H}"
@ONLY
)
@ -115,8 +115,8 @@ if(OPTION_CREATE_LINKS)
set(PREFIX_INCLUDE "${CMAKE_INSTALL_PREFIX}/${FLTK_INCLUDEDIR}")
endif(IS_ABSOLUTE ${FLTK_INCLUDEDIR})
configure_file(
"${FLTK_SOURCE_DIR}/CMake/install-symlinks.cmake.in"
"${FLTK_BINARY_DIR}/install-symlinks.cmake"
"${CMAKE_SOURCE_DIR}/CMake/install-symlinks.cmake.in"
"${CMAKE_BINARY_DIR}/install-symlinks.cmake"
@ONLY
)
endif(OPTION_CREATE_LINKS)

View File

@ -31,17 +31,17 @@ add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
)
install(DIRECTORY ${FLTK_SOURCE_DIR}/FL
install(DIRECTORY ${CMAKE_SOURCE_DIR}/FL
DESTINATION ${FLTK_INCLUDEDIR} USE_SOURCE_PERMISSIONS
PATTERN ".svn" EXCLUDE
)
install(DIRECTORY ${FLTK_BINARY_DIR}/FL
install(DIRECTORY ${CMAKE_BINARY_DIR}/FL
DESTINATION ${FLTK_INCLUDEDIR} USE_SOURCE_PERMISSIONS
)
if(OPTION_CREATE_LINKS)
install(SCRIPT ${FLTK_BINARY_DIR}/install-symlinks.cmake)
install(SCRIPT ${CMAKE_BINARY_DIR}/install-symlinks.cmake)
endif(OPTION_CREATE_LINKS)
# generate FLTKConfig.cmake for installed directory use
@ -55,22 +55,22 @@ install(EXPORT FLTK-Targets
)
configure_file(
${FLTK_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
${FLTK_BINARY_DIR}/etc/FLTKConfig.cmake
${CMAKE_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
${CMAKE_BINARY_DIR}/etc/FLTKConfig.cmake
@ONLY
)
install(FILES ${FLTK_BINARY_DIR}/etc/FLTKConfig.cmake
install(FILES ${CMAKE_BINARY_DIR}/etc/FLTKConfig.cmake
DESTINATION ${FLTK_CONFIG_PATH}
)
configure_file(
${FLTK_SOURCE_DIR}/CMake/UseFLTK.cmake.in
${FLTK_BINARY_DIR}/etc/UseFLTK.cmake
${CMAKE_SOURCE_DIR}/CMake/UseFLTK.cmake.in
${CMAKE_BINARY_DIR}/etc/UseFLTK.cmake
@ONLY
)
install(FILES ${FLTK_BINARY_DIR}/etc/UseFLTK.cmake
install(FILES ${CMAKE_BINARY_DIR}/etc/UseFLTK.cmake
DESTINATION ${FLTK_CONFIG_PATH}
)
@ -85,24 +85,24 @@ set(srcdir ".")
set(LIBNAME "${libdir}/libfltk.a")
configure_file(
"${FLTK_SOURCE_DIR}/fltk-config.in"
"${FLTK_BINARY_DIR}/bin/fltk-config"
"${CMAKE_SOURCE_DIR}/fltk-config.in"
"${CMAKE_BINARY_DIR}/bin/fltk-config"
@ONLY
)
if(UNIX)
execute_process(COMMAND chmod 755 fltk-config
WORKING_DIRECTORY "${FLTK_BINARY_DIR}/bin"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)
endif(UNIX)
install(PROGRAMS ${FLTK_BINARY_DIR}/bin/fltk-config
install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/fltk-config
DESTINATION ${FLTK_BINDIR}
)
if(UNIX OR MSYS OR (MINGW AND CMAKE_CROSSCOMPILING))
macro(INSTALL_MAN FILE LEVEL)
install(FILES
${FLTK_SOURCE_DIR}/documentation/src/${FILE}.man
${CMAKE_SOURCE_DIR}/documentation/src/${FILE}.man
DESTINATION ${FLTK_MANDIR}/man${LEVEL}
RENAME ${FILE}.${LEVEL}
)

View File

@ -264,8 +264,8 @@ if(OPTION_USE_SYSTEM_ZLIB AND ZLIB_FOUND)
else()
add_subdirectory(zlib)
set(FLTK_ZLIB_LIBRARIES fltk_z)
set(ZLIB_INCLUDE_DIR ${FLTK_SOURCE_DIR}/zlib)
include_directories(${FLTK_SOURCE_DIR}/zlib)
set(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib)
include_directories(${CMAKE_SOURCE_DIR}/zlib)
set(FLTK_BUILTIN_ZLIB_FOUND TRUE)
endif(OPTION_USE_SYSTEM_ZLIB AND ZLIB_FOUND)
@ -289,7 +289,7 @@ if(OPTION_USE_SYSTEM_LIBJPEG AND JPEG_FOUND)
else()
add_subdirectory(jpeg)
set(FLTK_JPEG_LIBRARIES fltk_jpeg)
include_directories(${FLTK_SOURCE_DIR}/jpeg)
include_directories(${CMAKE_SOURCE_DIR}/jpeg)
set(FLTK_BUILTIN_JPEG_FOUND TRUE)
endif(OPTION_USE_SYSTEM_LIBJPEG AND JPEG_FOUND)
@ -317,7 +317,7 @@ else()
set(HAVE_PNG_H 1)
set(HAVE_PNG_GET_VALID 1)
set(HAVE_PNG_SET_TRNS_TO_ALPHA 1)
include_directories(${FLTK_SOURCE_DIR}/png)
include_directories(${CMAKE_SOURCE_DIR}/png)
set(FLTK_BUILTIN_PNG_FOUND TRUE)
endif(OPTION_USE_SYSTEM_LIBPNG AND PNG_FOUND)

View File

@ -187,8 +187,8 @@ if(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX)
set(MSG "POSIX compatible scandir")
message(STATUS "Looking for ${MSG}")
try_compile(V
${FLTK_BINARY_DIR}
${FLTK_SOURCE_DIR}/CMake/posixScandir.cxx
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/CMake/posixScandir.cxx
)
if(V)
message(STATUS "${MSG} - found")

View File

@ -20,6 +20,7 @@
#######################################################################
# basic setup
#######################################################################
# The FLTK version
set(FLTK_VERSION_MAJOR "1")
set(FLTK_VERSION_MINOR "4")
@ -27,14 +28,14 @@ set(FLTK_VERSION_PATCH "0")
set(FLTK_VERSION "${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}")
set(FLTK_VERSION_FULL "${FLTK_VERSION}.${FLTK_VERSION_PATCH}")
set(EXECUTABLE_OUTPUT_PATH ${FLTK_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${FLTK_BINARY_DIR}/lib)
set(ARCHIVE_OUTPUT_PATH ${FLTK_BINARY_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
set(ARCHIVE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
# Search for modules in the FLTK source dir first
set(CMAKE_MODULE_PATH "${FLTK_SOURCE_DIR}/CMake")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
set(FLTK_INCLUDE_DIRS ${FLTK_BINARY_DIR} ${FLTK_SOURCE_DIR})
set(FLTK_INCLUDE_DIRS ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
include_directories(${FLTK_INCLUDE_DIRS})
# Setup install locations

View File

@ -58,8 +58,8 @@ include(CMake/variables.cmake)
include(CMake/export.cmake)
configure_file(
${FLTK_SOURCE_DIR}/abi-version.cmake.in
${FLTK_BINARY_DIR}/FL/abi-version.h
${CMAKE_SOURCE_DIR}/abi-version.cmake.in
${CMAKE_BINARY_DIR}/FL/abi-version.h
@ONLY
)

View File

@ -17,7 +17,7 @@
#
#######################################################################
set(EXECUTABLE_OUTPUT_PATH ${FLTK_BINARY_DIR}/bin/examples)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin/examples)
#######################################################################
# audio libs for test apps